## Change pre-estimated equation

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

Karl1
Posts: 27
Joined: Tue Aug 27, 2013 1:10 am

### Change pre-estimated equation

How does one change a pre-estimated equation with the use of commands?
Example: How to change
y = y(-1) + x
to
y = y(-4) + x

I do not want to reestimate the equation. I want to keep all coeffisient values.

EViews Glenn
EViews Developer
Posts: 2636
Joined: Wed Oct 15, 2008 9:17 am

### Re: Change pre-estimated equation

Unlink the equation in the model and edit the text [edit...sorry, missed the "with commands" part...I've asked Chris to look at this one as he's up-to-date on what can be done with command syntax in models].

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

### Re: Change pre-estimated equation

A number of commands to modify the model text were added in EViews v8.

replacevar is probably the one you're interested in.

eg. m.replacevar y(-1) y(-4)

will change *all* occurrences of y(-1) in the model text to y(-4).

If you only want to change a single equation you would have to extract the equation text from the model using something like:

string a = m.@spec("y")

manipulate it however you want, then put it back into the model with:

m.replace {a}

HollEviews
Posts: 15
Joined: Wed Mar 12, 2014 6:52 am

### 'replacevar' command

I am having difficulting figuring out how to use the 'replacevar' command to modify model equations. I have tried the following:

equation eqgid.ls dlog(gid_a) = c(1) + c(2)*(log(gid_a(-1)) - log(yed_a(-1))) + c(3)*dlog(yed_a) + c(4)*dlog(gid_a(-1))

minmod4.append :eqgid

minmod4.replacevar yed_a ypd_a

The unlinking works fine, so the model equation is replaced by text. But yed_a is not replaced with ypd_a by the replacevar command as I've input it. If you can spot any errors, I would be very grateful!

I also tried your other suggestion - extracting the equation using:

string eqgidt = minmod4.@spec("gid_a")

Creates a string object called eqgidt, with a text version of the equation. But I am having trouble with the command syntax to modify the equation. I tried:

@replace ("eqipdt", "yed_a", "ypd_a") but that doesn't seem to do the trick. Any pointers would be most appreciated!
Thank you!

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

### Re: Change pre-estimated equation

Might be a bug, we'll look into it.