Page 1 of 1

Recursive OLS estimation?

Posted: Mon Jan 09, 2012 2:12 pm
by jfca283
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.

Re: Recursive OLS estimation?

Posted: Mon Jan 09, 2012 2:22 pm
by EViews Gareth
What have you done so far?

Re: Recursive OLS estimation?

Posted: Mon Jan 09, 2012 2:28 pm
by jfca283
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.

Re: Recursive OLS estimation?

Posted: Mon Jan 09, 2012 2:44 pm
by EViews Gareth

Re: Recursive OLS estimation?

Posted: Mon Jan 09, 2012 2:52 pm
by jfca283
that code is above my knowledge...

Re: Recursive OLS estimation?

Posted: Mon Jan 09, 2012 3:03 pm
by EViews Gareth
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.

Re: Recursive OLS estimation?

Posted: Wed Jan 11, 2012 9:31 pm
by jfca283
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.

Re: Recursive OLS estimation?

Posted: Thu Jan 12, 2012 12:26 pm
by jfca283
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