loop regressions

For questions regarding programming in the EViews programming language.

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

kris170
Posts: 3
Joined: Wed Feb 19, 2014 4:41 am

loop regressions

Postby kris170 » Thu Feb 27, 2014 8:13 am

Hello,

I've just started out on Eviews 8, and was going to manually run 300+ regressions on monthly data in a ten year sample. Is it possible to create a loop instead that searches the start date of the dependent variable (in a spreadsheet) and selects the corresponding independent variables, and produces each summary statistics automatically? I've had a look at the introduction to programming page, but can't find something similar. I'm not asking for someone to create this, just if it's possible and somewhere I can learn how to do this.

Many thanks,

Kris

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

Re: loop regressions

Postby EViews Gareth » Thu Feb 27, 2014 9:10 am

I don't follow what you're trying to do. How can you select the independent variables based upon the start date of the data?

kris170
Posts: 3
Joined: Wed Feb 19, 2014 4:41 am

Re: loop regressions

Postby kris170 » Thu Feb 27, 2014 9:30 am

Apologies, each regression has a dependent variable that starts at a different date (no particular order) and I have independent variables for the whole ten years and in order to enable a OLS regression to be run, only the independent variables that determine the dependent variable should be used. For example if I were running three regressions, with dependent variables starting one, two and three years from now, then I would only want the corresponding independent variables starting from years one, two and three respectively.

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

Re: loop regressions

Postby EViews Gareth » Thu Feb 27, 2014 9:32 am

Still not following precisely.

Each regression has the same independent variables, but uses different observations of those variables?

Or each regression has completely different independent variables, where the choice of those variables is based on some rule?

kris170
Posts: 3
Joined: Wed Feb 19, 2014 4:41 am

Re: loop regressions

Postby kris170 » Thu Feb 27, 2014 9:52 am

The first statement is right, putting it into context, I have return data of firms and I'm trying to see what determines them, whereby the independent variables are market related. Only problem is I have 300+ of these returns and each firm has different inception dates and some return data stops before the sample end-date. I've copied and pasted data for three seperate regressions:

returns rm-rf Vol r^2 SMB HML WML
Nov-03 4.899999872 6.01 -1.919261041 36.1201 2.18 3.25 4.58
Dec-03 1.20000001 1.45 -0.605462217 2.1025 2.14 0.89 1.7
Jan-04 1.20000001 4.53 -1.770699557 20.5209 -2.68 1.63 -4.78
Feb-04 -1.600000076 2.04 -0.911105512 4.1616 1.7 1.42 2.33
Mar-04 -1.300000027 1.48 -0.14208089 2.1904 -0.51 0.72 -0.64
Apr-04 -2.899999917 -1.15 0.307498831 1.3225 2.3 0.28 0.13
May-04 -1.600000076 -1.99 0.582624878 3.9601 -1.87 -2.74 -5.17
Jun-04 0.499999989 1.14 -0.497396381 1.2996 -0.22 0.68 1.98
Jul-04 -4.199999943 2.1 -0.859969922 4.41 1.55 1.4 2.1
Aug-04 -0.200000009 -3.77 0.759017746 14.2129 -3.67 4.12 -2.08
Sep-04 -7.00000003 0.08 -0.037511347 0.0064 -1.33 1.4 -1.39
Oct-04 0.800000038 2.06 -0.59041607 4.2436 3.82 0.12 5.18
Nov-04 -1.099999994 1.68 -0.782395506 2.8224 0.33 0.23 -0.81
Dec-04 -0.700000022 4.61 -2.309117375 21.2521 3.99 1.29 3.4
Jan-05 -1.099999994 3.25 -1.234250538 10.5625 -0.22 -0.15 -2.4
Feb-05 -1.400000043 -2.61 0.984794116 6.8121 -1.27 1.58 3.27
Mar-05 0.200000009 2.2 -1.020277563 4.84 -0.16 1.69 4
Apr-05 4.600000009 -1.68 0.206295821 2.8224 -1.44 1.36 1.04
May-05 0.400000019 -2.86 1.201168058 8.1796 -3.89 -0.24 -0.94
Jun-05 3.700000048 3.37 -1.872360332 11.3569 2.47 -0.78 0.2
Jul-05 -0.499999989 0.95 -0.475098784 0.9025 2.82 2.37 2.81
Aug-05 -1.999999955 4.03 -1.991880512 16.2409 2.59 -0.87 0.8
Sep-05 -0.800000038 -0.74 0.36355778 0.5476 -0.54 1.53 3.6
Oct-05 -1.099999994 0.9 -0.074871175 0.81 0.07 1.44 3.84
Nov-05 -0.700000022 -2.5 1.378762899 6.25 -1.9 -0.7 -2.76
Dec-05 -0.200000009 3.85 -2.253538175 14.8225 1.19 -0.73 0.74
Jan-06 5.40000014 0.15 -0.057821084 0.0225 0.24 0.18 1.72
Feb-06 -0.400000019 3.5 -1.605865032 12.25 5.64 0.46 4.86
Mar-06 2.400000021 -0.52 0.290928694 0.2704 -0.44 0.57 -2.79
Apr-06 1.099999994 1.41 -0.711871428 1.9881 2.76 0.29 1.87


REGRESSION 2:

Jul-05 -0.779999979 0.95 -0.475098784 0.9025 2.82 2.37 2.81
Aug-05 5.8699999 4.03 -1.991880512 16.2409 2.59 -0.87 0.8
Sep-05 4.85999994 -0.74 0.36355778 0.5476 -0.54 1.53 3.6
Oct-05 2.199999988 0.9 -0.074871175 0.81 0.07 1.44 3.84
Nov-05 1.020000037 -2.5 1.378762899 6.25 -1.9 -0.7 -2.76
Dec-05 2.630000003 3.85 -2.253538175 14.8225 1.19 -0.73 0.74
Jan-06 1.269999985 0.15 -0.057821084 0.0225 0.24 0.18 1.72
Feb-06 3.880000114 3.5 -1.605865032 12.25 5.64 0.46 4.86
Mar-06 2.290000021 -0.52 0.290928694 0.2704 -0.44 0.57 -2.79
Apr-06 9.539999813 1.41 -0.711871428 1.9881 2.76 0.29 1.87
May-06 10.39000005 1.16 -0.293879481 1.3456 -0.11 2.56 1.34
Jun-06 15.38999975 -3.38 -0.04389538 11.4244 -2.71 2.28 -2.85
Jul-06 7.329999655 -0.53 0.056468467 0.2809 -0.81 0.37 0.29
Aug-06 -5.710000172 -0.73 0.405256969 0.5329 -2.96 2.68 -1.34
Sep-06 -0.980000012 2.13 -1.107369629 4.5369 0.68 -0.91 -3.21
Oct-06 0.37 1.32 -0.771749619 1.7424 -2.41 0.74 -1.82
Nov-06 1.169999968 3.3 -1.606431629 10.89 2.11 -0.74 -0.06
Dec-06 -3.590000048 1.74 -1.085395379 3.0276 -0.07 0.33 -0.57


REGRESSION 3:

May-12 1.049999986 -0.6 0.148139017 0.36 -0.88 -0.49 2.87
Jun-12 1.730000041 -6.7 -1.831762752 44.89 -0.62 0.48 6.1
Jul-12 0.860000029 3.73 -0.644813309 13.9129 0.44 0.46 -0.65
Aug-12 3.709999844 1.05 -0.501394422 1.1025 -2.21 0.47 1.84
Sep-12 0.769999996 2.69 -0.839204451 7.2361 0.93 0.44 -2.2
Oct-12 1.449999958 2.81 -1.121601028 7.8961 1.03 0.72 -1.8
Nov-12 3.050000034 -1.61 0.13505616 2.5921 -0.7 3.29 0.45
Dec-12 0.639999984 0.65 -0.229298936 0.4225 0.13 -0.84 0.96
Jan-13 4.100000113 1.27 -0.56219052 1.6129 1.79 3.09 -2.15
Feb-13 0.910000037 5.31 -1.187678842 28.1961 0.1 1.71 -0.72
Mar-13 -3.099999949 0.97 -0.581313669 0.9409 -0.9 0.09 2.18
Apr-13 2.229999937 3.7 -0.475550387 13.69 0.67 -0.37 2.15
May-13 1.669999957 1.29 -0.454633323 1.6641 -2.89 0.28 1.53
Jun-13 -1.530000009 2.49 0.005179439 6.2001 1.44 1.26 0.14
Jul-13 3.990000114 -1.54 0.955501951 2.3716 0.76 0.77 0.96
Aug-13 0.319999992 5.68 -2.01440569 32.2624 1.76 0.31 1.1
Sep-13 4.899999872 -2.56 1.384217906 6.5536 0.5 -2.04 -0.92
Oct-13 0.680000009 3.78 -0.944924733 14.2884 2.18 -1.26 3.39

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

Re: loop regressions

Postby EViews Gareth » Thu Feb 27, 2014 9:54 am

Just change the dependent variable, as shown in the examples in the programming guide in this thread. There's no need to change the independent variables (since they're the same, just with different observations). EViews will handle the observations automatically.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests