Cross-sectional regression

For questions regarding programming in the EViews programming language.

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

benkern
Posts: 1
Joined: Thu Mar 08, 2012 8:57 am

Cross-sectional regression

Postby benkern » Thu Mar 08, 2012 9:34 am

Hi I have gotten this eviews programming file from my teacher to do cross-sectional regression

'load the data
load "\your_own_path.wf1"
' Define number of obs and a matrix in which to store the results
scalar numberOfmonths=576
matrix(numberOfmonths,numberofportfolios) results

' Regression Loop
for !i=1 to numberOfmonths
smpl @all if month = !i 'PS! You need to have a variable called month that captures the variable to be looped over
equation eq1
eq1.ls y x
results (!i,1) = eq1.@coefs(1)


results (!i,2) = eq1.@coefs(2)
next

wfsave "\Your_own_path.wf1"

When I put in my variables I get error messages
Insuffient observations in "do_eq1.ls y beta"

'load the data
load "f:\Research\exercise1.2\exercice1.22.wf1"

' Define number of obs and a matrix in which to store the results
scalar numberOfmonths=576
matrix(576,25) results

I have made the month variable, grouped the 25 portfolioes in a Y variable (only the first line is showen in the group) and grouped the 25 betas to the portfolios in a simular way in an x group.
' Regression Loop
for !i=1 to 576
smpl @all if month = !i 'PS! You need to have a variable called month that captures the variable to be looped over
equation eq1
eq1.ls y beta
results (!i,1) = eq1.@coefs(1)
results (!i,2) = eq1.@coefs(2)
next

wfsave "f:\Research\exercise1.2\exercice1.22.wf1"

I have made the month variable, grouped the 25 portfolioes (named p1 to p 25)in a Y variable (only the first line is showen in the group) and grouped the 25 betas (named b1 to b25)to the portfolios in a simular way in an x group.
I also get the error message Y is not defined.

Have tried to get this program to work for 5 days now and can`t get around it even how much I try to red the inro to programming.

Plz help me.

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

Re: Cross-sectional regression

Postby EViews Gareth » Thu Mar 08, 2012 9:40 am

Hard to tell without having the data.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest