Rolling Regression

For questions regarding programming in the EViews programming language.

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

akbar892
Posts: 3
Joined: Wed Nov 30, 2011 2:10 am

Rolling Regression

Postby akbar892 » Wed Nov 30, 2011 2:45 am

I am working on my dissertation. I have eleven years monthly data on 300 stocks and the market index. I have already calculated the log returns for the stocks and market in excel and have imported the data into excel file. I need to estimate a rolling regression of each stock where the moving window is 36 that is the estimated coefficient needs to be based on last 36 months observations and then continue to drop the first month i.e. month 1 and add the next month i.e. month 37. I need to estimate the regression using GMM estimation. The model is given by sr c mrp ar(1) @ c sr(-1) mrp(-1). So far I have done the following:

!iwindow = 36
!istep = 1
!length = @obsrange
equation eq1
!nrolls = @round((!length-!iwindow)/!istep)
matrix(2,!nrolls) coefmat
!j=0
for !i = !iwindow to !length
!j=!j+1
smpl 2000m7 2000m7+!i+!i-2
eq1.gmm(options) sr2 c mrp ar(1) @ sr2(-1) mrp(-1)
Colplace(coefmat,eq1.@coefs,!j)
next


I am particularly worried about whether the moving window declaration above is correct as i am unsure of it. further when I run the program I get this message:
Matrix size mismatch in "Colplace(coefmat,eq1.@coefs,1)". The attached file contains data for analysis.

Further I need to know how to get access to the coefficients estimated above. Your help will be highly appreciated.

Regards
Attachments
Eviews1.WF1
It contains stock returns for company 2 and the market returns to estimate beta using GMM as estimation method
(10.68 KiB) Downloaded 260 times

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

Re: Rolling Regression

Postby EViews Gareth » Wed Nov 30, 2011 9:08 am

When you're setting your sample inside your for loop, you appear to be adjusting the end point of the sample, but not the start point.

Perhaps you want something like:

Code: Select all

smpl @first+!i-1 @first+!i-1+!window
(where I am assuming that 2000m7 is the first observation in your workfile).


As for the colplace error, you have 3 coefficients in your equation. You are trying to place a vector containing those three coefficients into a column of a matrix that only has 2 rows. Either you need to make your matrix one row bigger, or remove one coefficient from your equation.

akbar892
Posts: 3
Joined: Wed Nov 30, 2011 2:10 am

Re: Rolling Regression

Postby akbar892 » Fri Dec 02, 2011 3:05 am

Thanks alot. It worked. Now i am estimating GARCH M and have deviced the following:


!iwindow = 36
!istep = 1
!length = @obsrange
equation eq1
!nrolls = @round((!length-!iwindow)/!istep)
matrix(5,!nrolls) coefmat
!j=0
for !i = !iwindow to !length
!j=!j+1
smpl @first+!i-1 @first+!i-1+!window
eq1.garch(1,1,garchm=var) sr2 c mrp
Colplace(coefmat,eq1.@coefs,!j)
next

however, I only get the results for simple rolling garch. I have changed the coefficient matrix settings from5 to 6 but it still does not work. I will appreciate if you could help me on how to adjust this. further how would i insert option for student t distribution of GED etc.

Kind Regards

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

Re: Rolling Regression

Postby EViews Gareth » Fri Dec 02, 2011 8:55 am

You'll have to be more precise. Saying "it doesn't work" isn't particularly informative.

akbar892
Posts: 3
Joined: Wed Nov 30, 2011 2:10 am

Re: Rolling Regression

Postby akbar892 » Sat Dec 03, 2011 1:43 am

when i run the simple GARCH i get five coefficients for mean and the variance equation. however when i change the option to GARCH M and run the GARCH M there is no change in the coefficients from simple GARCH even when i change the no of coeffient in the matrix from 5 to 6. i.e I dont get the coeffcient in the mean equation for the "h".


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests