How does one change a preestimated 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.
Change preestimated equation
Moderators: EViews Gareth, EViews Moderator

 EViews Developer
 Posts: 2616
 Joined: Wed Oct 15, 2008 9:17 am
Re: Change preestimated 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 uptodate on what can be done with command syntax in models].

 EViews Developer
 Posts: 161
 Joined: Wed Sep 17, 2008 10:39 am
Re: Change preestimated 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}
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}

 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.unlink gid_a
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!
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.unlink gid_a
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!

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12299
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Change preestimated equation
Might be a bug, we'll look into it.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 1 guest