## Reestimate equation with different sample without specifying it again

For questions regarding programming in the EViews programming language.

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

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

### Reestimate equation with different sample without specifying it again

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.

Best,
Thomas

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

### Re: Reestimate equation with different sample without specifying it again

No one?

EViews Matt
EViews Developer
Posts: 336
Joined: Thu Apr 25, 2013 7:48 pm

### Re: Reestimate equation with different sample without specifying it again

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.@commandeq.{%com}`

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

EViews Matt
EViews Developer
Posts: 336
Joined: Thu Apr 25, 2013 7:48 pm

### Re: Reestimate equation with different sample without specifying it again

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>)`

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

### Re: Reestimate equation with different sample without specifying it again

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!

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

### Re: Reestimate equation with different sample without specifying it again

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?

EViews Matt
EViews Developer
Posts: 336
Joined: Thu Apr 25, 2013 7:48 pm

### Re: Reestimate equation with different sample without specifying it again

Code: Select all

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

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

### Re: Reestimate equation with different sample without specifying it again

It does, thanks a lot!

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

### Re: Reestimate equation with different sample without specifying it again

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?

EViews Matt
EViews Developer
Posts: 336
Joined: Thu Apr 25, 2013 7:48 pm

### Re: Reestimate equation with different sample without specifying it again

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)`

tho_mi
Posts: 61
Joined: Sat May 12, 2012 2:41 am

Thanks a lot!