Page 1 of 1

Moving sample

Posted: Sat Mar 14, 2015 7:08 pm
by miorinnovo
Hi,

I'm wondering if there's a way to program an equation so that its estimation uses all data up to point of the next forecast. For example, right now I have one part of the sample (sample1) used to estimate the equation and the rest of the sample (sample2) to create the forecast. As here:

smpl sample1
equation eq1.ls y c x
smpl sample2
eq1.fit y_f

What I'd like to do is have the sample1 not be a fixed set of dates but all the data up to the point of the forecast, so it moves.

Any ideas?

Much appreciated and thanks in advance.

Re: Moving sample

Posted: Sat Mar 14, 2015 8:59 pm
by EViews Gareth
It is called a rolling regression or forecast and there are tons of examples on the forum

Re: Moving sample

Posted: Mon May 18, 2015 9:12 am
by Afterall
Does anyone know what is wrong in a sample time for this program.:

scalar start= @dtoo("12/31/2012")
scalar end= @dtoo("12/31/2013")
equation eq1
!step=1
for !i =start to end step !step
%date = @otod(!i-1)
scalar element = @elem(h_window, %date)

'reg. equation
smpl (!i-element) (!i)
eq1.ls mah01 c mah01(-1) mah01(-7)

' make forecasts
smpl !i !i
eq2.forecast(f=na) tmp_yhat tmp_se'
mahh01f= tmp_yhat
mahh01f_se = tmp_se
next

The algorithm has to be good, because is taken from some other program language. But I'm not so good program user in eviews.

Re: Moving sample

Posted: Mon May 18, 2015 10:20 am
by EViews Gareth
You're trying to set the sample with integers, but your file is dated, so you need to set the sample with dates. You can use the @otod function to convert from an integer observation number into a date.