LOOP PROGRAMMING

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

LOOP PROGRAMMING

Postby adarshad » Tue Oct 16, 2018 3:41 pm

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

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Tue Oct 16, 2018 4:03 pm

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 Matt
EViews Developer
Posts: 302
Joined: Thu Apr 25, 2013 7:48 pm

Re: LOOP PROGRAMMING

Postby EViews Matt » Tue Oct 16, 2018 4:23 pm

Hello,

How is your data organized? For example, are Y1 and Y2 different series, or are they different parts (observations) of one series?

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Thu Oct 18, 2018 12:28 am

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
Last edited by adarshad on Thu Oct 18, 2018 12:37 am, edited 2 times in total.

EViews Matt
EViews Developer
Posts: 302
Joined: Thu Apr 25, 2013 7:48 pm

Re: LOOP PROGRAMMING

Postby EViews Matt » Thu Oct 18, 2018 9:16 am

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,

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.

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Mon Oct 22, 2018 5:04 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11875
Joined: Tue Sep 16, 2008 5:38 pm

Re: LOOP PROGRAMMING

Postby EViews Gareth » Mon Oct 22, 2018 5:11 am

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
Follow us on Twitter @IHSEViews

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Tue Oct 23, 2018 7:57 am

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3384
Joined: Wed Sep 17, 2008 2:25 pm

Re: LOOP PROGRAMMING

Postby startz » Tue Oct 23, 2018 8:02 am

The best thing to do is to copy your entire program into a post. Perhaps post the relevant workfile as well.

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Tue Oct 23, 2018 8:17 am

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
Attachments
Untitled.png
Untitled.png (9.04 KiB) Viewed 879 times
Last edited by adarshad on Tue Oct 23, 2018 3:12 pm, edited 2 times in total.

startz
Non-normality and collinearity are NOT problems!
Posts: 3384
Joined: Wed Sep 17, 2008 2:25 pm

Re: LOOP PROGRAMMING

Postby startz » Tue Oct 23, 2018 8:36 am

Did you include a next statement in your program file?

You do not seem to have a series X2B

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Tue Oct 23, 2018 8:55 am

i have corrected the dataset and what should i run;;;i couldnot anything;;its beyond my thought

startz
Non-normality and collinearity are NOT problems!
Posts: 3384
Joined: Wed Sep 17, 2008 2:25 pm

Re: LOOP PROGRAMMING

Postby startz » Tue Oct 23, 2018 8:58 am


EViews Matt
EViews Developer
Posts: 302
Joined: Thu Apr 25, 2013 7:48 pm

Re: LOOP PROGRAMMING

Postby EViews Matt » Tue Oct 23, 2018 9:05 am

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?

adarshad
Posts: 39
Joined: Wed Sep 05, 2018 10:32 am

Re: LOOP PROGRAMMING

Postby adarshad » Tue Oct 23, 2018 10:47 am

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


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 20 guests