Page 1 of 1

Change pre-estimated equation

Posted: Fri Nov 15, 2013 6:46 am
by Karl1
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.

Re: Change pre-estimated equation

Posted: Fri Nov 15, 2013 12:50 pm
by EViews Glenn
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].

Re: Change pre-estimated equation

Posted: Fri Nov 15, 2013 4:58 pm
by EViews Chris
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' command

Posted: Tue Apr 29, 2014 5:21 am
by HollEviews
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!

Re: Change pre-estimated equation

Posted: Tue Apr 29, 2014 7:58 am
by EViews Gareth
Might be a bug, we'll look into it.