Recursive OLS estimation?

For questions regarding programming in the EViews programming language.

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

jfca283
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Recursive OLS estimation?

Postby jfca283 » Mon Jan 09, 2012 2:12 pm

Hi
I need to make a recursive ols estimation saving SDeviation, coefficients and expected mean.
First, i need to run a ols model from t=0,...,T. Then i must run ols estimations like this
ols from sample 0,...,T-0
ols from sample 0,...,T-1
ols from sample 0,...,T-2
...
ols from sample 0,...,T+1-length(data)

T=length(data)

for !i =1 to length(data) or rowcount (I'm not sure)
eq1.ls gnp c gnp(-1) rate

then i need to store R2, coefficients, SD, mean, and pvalues for each ols estimation generated. I'm a bit lost.
I've read http://forums.eviews.com/viewtopic.php?f=5&t=1638 but i need do the resampling process...that's where i'm stuck.
Thanks for your time and interest.

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

Re: Recursive OLS estimation?

Postby EViews Gareth » Mon Jan 09, 2012 2:22 pm

What have you done so far?

jfca283
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Recursive OLS estimation?

Postby jfca283 » Mon Jan 09, 2012 2:28 pm

for example, i know how to declare the model i want or i know reading the tricks and guide posted on the forum. But there is nothing related to a
For sample i! 1 to rowcounter
i want to be able to declare the loop. The loop for resampling the data and estimate by ols.

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

Re: Recursive OLS estimation?

Postby EViews Gareth » Mon Jan 09, 2012 2:44 pm


jfca283
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Recursive OLS estimation?

Postby jfca283 » Mon Jan 09, 2012 2:52 pm

that code is above my knowledge...

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

Re: Recursive OLS estimation?

Postby EViews Gareth » Mon Jan 09, 2012 3:03 pm

Well, you aren't going to be able to program what you want to do without understanding that program. You should read through that program line by line, and work out what each line does by referring to the Command and Programming Reference, and the posts on these forums. If you have specific questions, we'll be happy to help.

jfca283
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Recursive OLS estimation?

Postby jfca283 » Wed Jan 11, 2012 9:31 pm

thanks a lot for your help. The link you gave was very useful
these what i made and it worked, but i have some doubts about positions

Code: Select all

!length=@obsrange vector(!length) roll_betas vector(!length) roll_mediadep vector(!length) roll_desvsd for !i=0 to !length-2 smpl @first @first+!i+1 equation eq1 eq1.ls nd c ne roll_betas(!i+1) = eq1.@coef(2) roll_mediadep(!i+1)=eq1.@meandep roll_desvsd(!i+1)=eq1.@sddep next
I have n=130 obs, and i get 129 estimations of beta(coeficients), mean and sdeviation. Is it OK? And how do i graph by code? How do i graph the SDeviation, i mean, the positive and negative values? because i obtained only positive numbers and when i manually plot them, i only show the sd above zero. I know, it's a dumb question. Thanks again by your help.

jfca283
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Recursive OLS estimation?

Postby jfca283 » Thu Jan 12, 2012 12:26 pm

Hi
i need now to estimate the mean and sd for the fitted values in every loop. How do i store them?
i had declared in eq1 the model and i read the manual, but i couldn't find the function. Thanks


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests