LOOP PROGRAMMING
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
LOOP PROGRAMMING
HI
I AM TRYING TO CREATE LOOP AS I HAVE 29 COMPANIES FOR DEPENDENT VARIABLE AND ALL INDEPENDENTS VARY FOR EACH COMPANY .I WANT TO USE OLS REGRESSION BUT I CANNOT BALANCE FOR EACH COMPANY SEPERTAELY AS I NEED ONE MODEL FOR ALL COMPANIES;CAN YOU HELP ME AN OLS REGRESSION THAT TAKES ALL 29 COMPANIES DATA SEPERATELY AND CAN OUTPUT WHEN MY TWO MAIN INDEPENDENT VARIABLES BECOME SIGNIFICANT FOR EACH COMPANY USING OLS REGRESSION? OR EVEN IF I CHANGE VALUE FOR ONE COMPANY FOR INDEPENDENT VARIABLES AND IT CHANGES IN ALL EQUATION;I DONOT WANT TO RUN 29 EQUATIONS SEPERATELY;I WOULD HAVE SAME DEPENDENT VARIABLE AND SAME INDEPENDENT VARIABLES BUT NEED TO RUN EACH INDIVIDUALLY IN A LOOP AND GIVE VALUES FOR EACH PROBABILITY VALUES AND COFFICIENTS..EG FOR COMPANY A AND COMPANY B AND COMPANY C BUT IN SAME LOOP;I HAVE 29 COMPANIES AND HAVE 261 OBSERVATIONS FOR EACH COMPANY IN A TIMESERIES OLS REGRESSION
I AM TRYING TO CREATE LOOP AS I HAVE 29 COMPANIES FOR DEPENDENT VARIABLE AND ALL INDEPENDENTS VARY FOR EACH COMPANY .I WANT TO USE OLS REGRESSION BUT I CANNOT BALANCE FOR EACH COMPANY SEPERTAELY AS I NEED ONE MODEL FOR ALL COMPANIES;CAN YOU HELP ME AN OLS REGRESSION THAT TAKES ALL 29 COMPANIES DATA SEPERATELY AND CAN OUTPUT WHEN MY TWO MAIN INDEPENDENT VARIABLES BECOME SIGNIFICANT FOR EACH COMPANY USING OLS REGRESSION? OR EVEN IF I CHANGE VALUE FOR ONE COMPANY FOR INDEPENDENT VARIABLES AND IT CHANGES IN ALL EQUATION;I DONOT WANT TO RUN 29 EQUATIONS SEPERATELY;I WOULD HAVE SAME DEPENDENT VARIABLE AND SAME INDEPENDENT VARIABLES BUT NEED TO RUN EACH INDIVIDUALLY IN A LOOP AND GIVE VALUES FOR EACH PROBABILITY VALUES AND COFFICIENTS..EG FOR COMPANY A AND COMPANY B AND COMPANY C BUT IN SAME LOOP;I HAVE 29 COMPANIES AND HAVE 261 OBSERVATIONS FOR EACH COMPANY IN A TIMESERIES OLS REGRESSION
Re: LOOP PROGRAMMING
adarshad wrote:HI
I AM TRYING TO CREATE LOOP AS I HAVE 29 COMPANIES FOR DEPENDENT VARIABLE AND ALL INDEPENDENTS VARY FOR EACH COMPANY .I WANT TO USE OLS REGRESSION BUT I CANNOT BALANCE FOR EACH COMPANY SEPERTAELY AS I NEED ONE MODEL FOR ALL COMPANIES;CAN YOU HELP ME AN OLS REGRESSION THAT TAKES ALL 29 COMPANIES DATA SEPARATELY AND CAN OUTPUT WHEN MY TWO MAIN INDEPENDENT VARIABLES BECOME SIGNIFICANT FOR EACH COMPANY USING OLS REGRESSION? OR EVEN IF I CHANGE VALUE FOR ONE COMPANY FOR INDEPENDENT VARIABLES AND IT CHANGES IN ALL EQUATION;I DONOT WANT TO RUN 29 EQUATIONS SEPARATELY;I WOULD HAVE SAME DEPENDENT VARIABLE AND SAME INDEPENDENT VARIABLES BUT NEED TO RUN EACH INDIVIDUALLY IN A LOOP AND GIVE VALUES FOR EACH PROBABILITY VALUES AND COFFICIENTS..EG FOR COMPANY A AND COMPANY B AND COMPANY C BUT IN SAME LOOP;I HAVE 29 COMPANIES AND HAVE 261 OBSERVATIONS FOR EACH COMPANY IN A TIMESERIES OLS REGRESSION
SIR
I WANT TO CREATE REGRESSION EQUATION FOR EACH COMPANY SEPARATELY TAKING SEPARATE INDEPENDENT VARIABLES E.G FOR Y1= x1.A1 + X2.b1 AND FOR FOR Y2=x1.A2 + X2.B2 SUCH THAT Y1 IS RETURNS OF COMPANY APPLE REGRESSED BY DIVIDENDS OF APPLE x1.A1 AND PROFITABILITY OF APPLE X2.b1 AND THEN FOR COMPANY MICROSOFT THE RETURNS OF MICROSOFT REGRESSED BY DIVIDENDS OF MICROSOFT AND PROFITABILITY OF MICROSOFT AND UPTO 29 COMPANIES AND RUNNING OLS REGRESSSION OF ALL THESE IN LOOP SO THAT I CAN RUN ONE LOOP TO DETERMINE RESULTS FOR EACH
THANKS

 EViews Developer
 Posts: 327
 Joined: Thu Apr 25, 2013 7:48 pm
Re: LOOP PROGRAMMING
Hello,
How is your data organized? For example, are Y1 and Y2 different series, or are they different parts (observations) of one series?
How is your data organized? For example, are Y1 and Y2 different series, or are they different parts (observations) of one series?
Re: LOOP PROGRAMMING
Y1 is returns for company 1 and y2 is return for company 2 .I WANT TO RUN A LOOP THAT RUNS DATA FOR
ALL COMPANIES OF GROUP OF 29 SEPERATELY AND TAKES VALUES OF ONE COMPANY FOR EACH VARIABLE AND THEN COMPUTES FOR 2ND;
where Y1 is dependent variable for company 1 , x1.a1 is first independent variable for company 1 and x1.b1 for second dependent variable
WHILE FOR COMPANY 2
y2 is dependent variable ,x2.A2 IS FIRST INDEPENDENT VARIABLE WHILE X2.B2 WILL BE SECOND INDEPENDENT VARIABLE
FOR COMPANY 1 Y1=x1.a1 +x1.b1 (eq1)
FOR COMPANY 2 Y2=x2.a2 +x2.b2 (eq2)
FOR COMPANY 3 Y3=x3.a3 +x3.b3 (eq3)
.
.
.
.
FOR COMPANY 29 Y29=x29.a29 +x29.b29 (eq3)
HERE Y1 DEPICTING RETURN FOR COMPANY 1 AND Y2 ARE RETURNS FOR COMPANY 2 ;THE VARIABLE IS RETURN BUT FOR COMPANY 1 COMPANY 2;LIKEWISE X1.A1 IS DIVIDEND FOR COMPANY 1 AND X2.A2 IS DIVIDEND FOR COMPANY 2? THEY ARE ALL DIFFERENT SERIES
CAN YOU WRITE ME PROGRAM FOR RUNNING FOR 29 COMPANIES AND INCLUDING ONE DPENEDENT VARIABLE AND 8 INDEPENDENT VARIABLES AND INTERCEPT AND STORING PVALUES AND COEFFICIENTS FOR EACH EQUATION IN LOOP
[color=#BF4000]you can arrange as you can wish and name;i will understand your program.a program that takes dependent variables of 29 companies and regresses for their respective independent variables for each company.i just want to run all 29 EQUATIONS IN SAME PROGRAM AND WHICH GIVE TABLE OF PVALUES AND COEFFICIENTS RATHER I RUN EACH EQUATION SEPERATELY
EVERY COMPANY HAS ONE DEPENDENT VARIABLE WIL BE REGRESSED AGAINST 8 INDEPENDENT VARIABLE AND INTERCEPT;YOU CAN NAME AS NUMBERS TO CREATE ITERATION;IT HAS BEEN TOO MUCH LONGING[/color]
THANKS FOR YOUR SUPPORT
THANKS
ALL COMPANIES OF GROUP OF 29 SEPERATELY AND TAKES VALUES OF ONE COMPANY FOR EACH VARIABLE AND THEN COMPUTES FOR 2ND;
where Y1 is dependent variable for company 1 , x1.a1 is first independent variable for company 1 and x1.b1 for second dependent variable
WHILE FOR COMPANY 2
y2 is dependent variable ,x2.A2 IS FIRST INDEPENDENT VARIABLE WHILE X2.B2 WILL BE SECOND INDEPENDENT VARIABLE
FOR COMPANY 1 Y1=x1.a1 +x1.b1 (eq1)
FOR COMPANY 2 Y2=x2.a2 +x2.b2 (eq2)
FOR COMPANY 3 Y3=x3.a3 +x3.b3 (eq3)
.
.
.
.
FOR COMPANY 29 Y29=x29.a29 +x29.b29 (eq3)
HERE Y1 DEPICTING RETURN FOR COMPANY 1 AND Y2 ARE RETURNS FOR COMPANY 2 ;THE VARIABLE IS RETURN BUT FOR COMPANY 1 COMPANY 2;LIKEWISE X1.A1 IS DIVIDEND FOR COMPANY 1 AND X2.A2 IS DIVIDEND FOR COMPANY 2? THEY ARE ALL DIFFERENT SERIES
CAN YOU WRITE ME PROGRAM FOR RUNNING FOR 29 COMPANIES AND INCLUDING ONE DPENEDENT VARIABLE AND 8 INDEPENDENT VARIABLES AND INTERCEPT AND STORING PVALUES AND COEFFICIENTS FOR EACH EQUATION IN LOOP
[color=#BF4000]you can arrange as you can wish and name;i will understand your program.a program that takes dependent variables of 29 companies and regresses for their respective independent variables for each company.i just want to run all 29 EQUATIONS IN SAME PROGRAM AND WHICH GIVE TABLE OF PVALUES AND COEFFICIENTS RATHER I RUN EACH EQUATION SEPERATELY
EVERY COMPANY HAS ONE DEPENDENT VARIABLE WIL BE REGRESSED AGAINST 8 INDEPENDENT VARIABLE AND INTERCEPT;YOU CAN NAME AS NUMBERS TO CREATE ITERATION;IT HAS BEEN TOO MUCH LONGING[/color]
THANKS FOR YOUR SUPPORT
THANKS
Last edited by adarshad on Thu Oct 18, 2018 12:37 am, edited 2 times in total.

 EViews Developer
 Posts: 327
 Joined: Thu Apr 25, 2013 7:48 pm
Re: LOOP PROGRAMMING
Series names cannot include periods, but if your independent variable series were named x1a, x1b, x2a, x2b, etc., I believe a small loop is all you need to generate the 29 equations. For example,
You can add the additional independent variable names, of course.
Code: Select all
for !i = 1 to 29
equation eq!i.ls y!i x!ia x!ib c
next
You can add the additional independent variable names, of course.
Re: LOOP PROGRAMMING
I understand how i need to design but how to get input from the eviews and run the equation.your representation is good.can you write me a formal program
Last edited by adarshad on Tue Oct 23, 2018 6:23 am, edited 1 time in total.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11926
 Joined: Tue Sep 16, 2008 5:38 pm
Re: LOOP PROGRAMMING
We do not offer a program writing service (at least not a free one).
Also, please refrain from typing in all caps.
https://en.wikipedia.org/wiki/All_caps#Computing
Also, please refrain from typing in all caps.
https://en.wikipedia.org/wiki/All_caps#Computing
Follow us on Twitter @IHSEViews
Re: LOOP PROGRAMMING
i tried your loop but it says equation! is illegal;;can you help me just a program to create these equations and execute it;;i will do all further things myself

 Nonnormality and collinearity are NOT problems!
 Posts: 3406
 Joined: Wed Sep 17, 2008 2:25 pm
Re: LOOP PROGRAMMING
The best thing to do is to copy your entire program into a post. Perhaps post the relevant workfile as well.
Re: LOOP PROGRAMMING
i have all my data arranged into a eviews workfile and had it opened ;;i just want to create these equations for i=28 but it says equation name is reserved; should i declare some sort of equation syntax before to run it successfully? because its not creating anything
the code is
for !i = 1 to 28
equation eq!i.ls y!i x!ia x!ib x!ic x!id c
and eview says
the code is
for !i = 1 to 28
equation eq!i.ls y!i x!ia x!ib x!ic x!id c
and eview says
 Attachments

 Untitled.png (9.04 KiB) Viewed 1858 times
Last edited by adarshad on Tue Oct 23, 2018 3:12 pm, edited 2 times in total.

 Nonnormality and collinearity are NOT problems!
 Posts: 3406
 Joined: Wed Sep 17, 2008 2:25 pm
Re: LOOP PROGRAMMING
Did you include a next statement in your program file?
You do not seem to have a series X2B
You do not seem to have a series X2B
Re: LOOP PROGRAMMING
i have corrected the dataset and what should i run;;;i couldnot anything;;its beyond my thought

 EViews Developer
 Posts: 327
 Joined: Thu Apr 25, 2013 7:48 pm
Re: LOOP PROGRAMMING
Curious, the loop executes just fine for me with your provided workfile. Are you running the commands as a program (File > New > Program), not in the Command window?
Re: LOOP PROGRAMMING
can you post me your code so that i can run the code and see what is wrong on my side;i will be too much thankful to you
Who is online
Users browsing this forum: No registered users and 10 guests