Page 1 of 1

Reestimate equation with different sample without specifying it again

Posted: Thu Mar 08, 2018 12:45 pm
by tho_mi
Hey,

my question is very easy. At the beginning I specify an equation. I want to do "real-time fitting", i.e. calculate the fitted values based on the estimation of data up to this point. Is there a way to reestimate an already existing equation (with a different sample) without specifying it again?

Let's say I have data from 1970 to 2010. I want to to "real-time fitting" for the period 1990 to 2010. In a loop I start with the estimation of the model based on data from 1970 to 1990 and then I save the fitted values for 1990. In the next step I do this again for 1991. As far as I see I have to specify the equation each time I want to estimate it. Is there a way to just reestimate it for a different sample (something like equation_name.update)? I've already looked in the command reference, but haven't found anything that helps.

Thanks in advance!

Best,
Thomas

Re: Reestimate equation with different sample without specifying it again

Posted: Sun Mar 11, 2018 11:25 am
by tho_mi
No one?

Re: Reestimate equation with different sample without specifying it again

Posted: Mon Mar 12, 2018 9:32 am
by EViews Matt
Hello,

An equation object stores its own specification, which you can access to reestimate the equation without explicitly respecifying it:

Code: Select all

%com = eq.@command
eq.{%com}

You'd need to set the new sample before the above code, as the above implicitly uses the current workfile sample.

Re: Reestimate equation with different sample without specifying it again

Posted: Mon Mar 12, 2018 10:16 am
by EViews Matt
Just learned from EViews Gareth that there's a currently undocumented reestimate proc for equations. The following reestimates an equation with its original sample.

Code: Select all

eq.reestimate

The following reestimates an equation with the provided <sample spec>.

Code: Select all

eq.reestimate(smpl=<sample spec>)

Re: Reestimate equation with different sample without specifying it again

Posted: Tue Mar 13, 2018 11:31 am
by tho_mi
That's awesome, thanks a lot! Currently I use @varlist to get the variables from the equation to estimate it again. Your solution is obviously far better!

Re: Reestimate equation with different sample without specifying it again

Posted: Fri Mar 16, 2018 3:08 pm
by tho_mi
I just tried it. Unfortunately it doesn't work. I estimated the equation for all years up to 1994. Then I tried to reestimate it for all years before 2000:

Code: Select all

equation_name.reestimate(@year < 2000)


The result still says:

Code: Select all

Sample: 1970 2013 IF @YEAR<=1994   


What did I do wrong?

Re: Reestimate equation with different sample without specifying it again

Posted: Fri Mar 16, 2018 3:52 pm
by EViews Matt
Your example should work via:

Code: Select all

equation_name.reestimate(smpl=if @year < 2000)

Re: Reestimate equation with different sample without specifying it again

Posted: Sat Mar 17, 2018 5:47 am
by tho_mi
It does, thanks a lot! :)

Re: Reestimate equation with different sample without specifying it again

Posted: Sat Mar 17, 2018 6:12 am
by tho_mi
I have an additional question. If I set the sample in the "Estimation settings" (and not in the workfile), then the sample given to the reestimate procedure seems to be only a "subsample" of the one in the "Estimation settings". In other words, if there isn't the whole sample in the settings the reestimate procedure will not work "properly". Is there a command to change the sample in the settings? I just want to make sure that the whole sample is selected before doing the reestimate.

E.g. in the "Estimation settings" the sample "1970 2002" is used. The command

Code: Select all

equation_name.reestimate(smpl = if @year <= 2010)


will then only use the sample up to 2002. I assume that the reestimate procedure will also update the sample used in the makeresid procedure?

Re: Reestimate equation with different sample without specifying it again

Posted: Sun Mar 18, 2018 6:20 am
by EViews Matt
You should be able to include @all in the reestimate sample, just as if you were using the smpl command:

Code: Select all

equation_name.reestimate(smpl = @all if @year <= 2010)

Re: Reestimate equation with different sample without specifying it again

Posted: Mon Mar 19, 2018 11:11 am
by tho_mi
Thanks a lot!