Hello,
I created a small model with about 10 equations, and I'd like to store the coefficents from each equation into 10 coefficient vecotrs (1 vector for each equation).
How can I do this, in the context of a model? I crreatec a cofficient object called "zzz" and tried to include this as a line in my model:
zzz = eq01.@coefs
But it says "illegal lag or index specification" for coefficient zzz.
I know this can be done by a program, but I really would prefer to stick with the user interface and the model object.
PLEASE help,
Thank you,
Basic question - Storing Coefficients - Please Help
Moderators: EViews Gareth, EViews Moderator
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Basic question - Storing Coefficients - Please Help
vector zzz=eq01.@coefs
or
coef zzz=eq01.@coefs
or
coef zzz=eq01.@coefs
Re: Basic question - Storing Coefficients - Please Help
H Glenn,
Thanks for the reply. But this isn't really working when I add it as a line in my model. I get "Syntax error in "vector zzz=eq01.@coefs".
The thing is I'm adding it as a line in a "model" object, and not as a line in a program. Is there any other way to do it?
It seems like a really simple thing to do, but I just can't figure it out.
thanks!
Thanks for the reply. But this isn't really working when I add it as a line in my model. I get "Syntax error in "vector zzz=eq01.@coefs".
The thing is I'm adding it as a line in a "model" object, and not as a line in a program. Is there any other way to do it?
It seems like a really simple thing to do, but I just can't figure it out.
thanks!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Basic question - Storing Coefficients - Please Help
Extracting the coefficients of an equation as part of a model specification really makes no sense. Perhaps you should tell us what you're hoping to accomplish.
Re: Basic question - Storing Coefficients - Please Help
Hi Gareth,
I just want to be able to store the coefficients of some equations. Let's say I have only two equations ("equation" objects):
Y = c(1) +c(2)*consumption
X = d(1) + d(2)*moneysupply
And I create a "model" object, and put both these equations in that model. The model object automatically numbers them (eq1 and eq2).
And now I want to use c(2) and d(2) in another equation in my model. For example, let's say that I have a vector V, and I want to write a third equation (not a regression equation) as:
v = c(2)*interestrate + d(2)*investment.
or let's say I simply want to store the c(2) and d(2) to use them in a different model.
I take it from what you're saying that this is not possible because it doesn't make any sense in a model specification. I think I see your point, but what would be the alternative?
Basically, I want to somehow make EViews automatically store my coefficients every time I run the equation or model, if possible.
I don't mind doing this outside a model specification, but then how can I number the equations? How would EViews know which equation is eq01 and which is eq02?
Thanks again for your help.
I just want to be able to store the coefficients of some equations. Let's say I have only two equations ("equation" objects):
Y = c(1) +c(2)*consumption
X = d(1) + d(2)*moneysupply
And I create a "model" object, and put both these equations in that model. The model object automatically numbers them (eq1 and eq2).
And now I want to use c(2) and d(2) in another equation in my model. For example, let's say that I have a vector V, and I want to write a third equation (not a regression equation) as:
v = c(2)*interestrate + d(2)*investment.
or let's say I simply want to store the c(2) and d(2) to use them in a different model.
I take it from what you're saying that this is not possible because it doesn't make any sense in a model specification. I think I see your point, but what would be the alternative?
Basically, I want to somehow make EViews automatically store my coefficients every time I run the equation or model, if possible.
I don't mind doing this outside a model specification, but then how can I number the equations? How would EViews know which equation is eq01 and which is eq02?
Thanks again for your help.
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Basic question - Storing Coefficients - Please Help
If you name all your coefficients c(1), c(2), etc. in the model, you'll find that EViews automatically stores them in the C vector in the workfile without your needing to do anything.
Last edited by startz on Fri Sep 09, 2011 11:10 am, edited 1 time in total.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Basic question - Storing Coefficients - Please Help
Re: Startz's comment...True, but those coefficients can get overwritten as you do other things. You are best off not counting on them being the same as when you estimated...
Re: the jason_ll's comment...What Gareth is saying is that storing the coefficients inside a model doesn't make sense since the model does no updating of coefficients. You can store your coefficients *outside* of the model using the syntax I gave you earlier and then make your third model refer to the elements of the stored coefficient vectors.
As to numbering the equations. Why does EViews need to number the equations? Once you save the coefficients you are working with the saved coefficient vectors not the equation.
or something of the sort.
In fact, thinking about it, you should be able to skip the saving altogether and write in terms of the coefficients of the equations.
Re: the jason_ll's comment...What Gareth is saying is that storing the coefficients inside a model doesn't make sense since the model does no updating of coefficients. You can store your coefficients *outside* of the model using the syntax I gave you earlier and then make your third model refer to the elements of the stored coefficient vectors.
As to numbering the equations. Why does EViews need to number the equations? Once you save the coefficients you are working with the saved coefficient vectors not the equation.
Code: Select all
equation eq01.ls y c x1 x2 x3
coef eq01_coefs = eq01.@coefs
equation eq02.ls y c z1 z2 z3
coef eq02_coefs = eq01.@coefs
model a
a.append :eq01
a.append w = eq02_coefs(1) + eq01_coefs(2)*x1 + eq02_coefs(3)*z2
solve aIn fact, thinking about it, you should be able to skip the saving altogether and write in terms of the coefficients of the equations.
Code: Select all
equation eq01.ls y c x1 x2 x3
equation eq02.ls y c z1 z2 z3
model a
a.append :eq01
a.append w = eq02.@coef(1) + eq01.@coef(2)*x1 + eq02.@coef(3)*z2
solve aRe: Basic question - Storing Coefficients - Please Help
Thanks again for the replies! It works now.
Please ignore my comment on numbering the equations. I thought that "eq01" was referring to some equation's number, as opposed to the actual equation name. Now it makes a lot more sense.
The only minor lingering problem that remains: is there any way to make these coefficients update automatically?
For example, I have an equation called "demand", and I add a couple of variables to it. Instead of having to retype the command "vector zzz = demand.@coefs" to store the new coefficients, is there a way for EViews to do that automatically? It would be ideal if I can get a ceof object to work similarly to an auto-updating series.
Please ignore my comment on numbering the equations. I thought that "eq01" was referring to some equation's number, as opposed to the actual equation name. Now it makes a lot more sense.
The only minor lingering problem that remains: is there any way to make these coefficients update automatically?
For example, I have an equation called "demand", and I add a couple of variables to it. Instead of having to retype the command "vector zzz = demand.@coefs" to store the new coefficients, is there a way for EViews to do that automatically? It would be ideal if I can get a ceof object to work similarly to an auto-updating series.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Basic question - Storing Coefficients - Please Help
There isn't, which is why the method where you don't export to a coef, but rather use the equation and coef directly in the model may make more sense for your particular application.
Re: Basic question - Storing Coefficients - Please Help
Gotcha!
Thanks a lot for all those who replied.
Thanks a lot for all those who replied.
Who is online
Users browsing this forum: No registered users and 2 guests
