Hello,
I am using Eviews 7.2, updated and am presently trying to write a program that generates a model object. I have a simple problem/question that I have yet to find a good solution to (probably just ignorance on my part):
Let us say for example that I have N equations describing consumption by product CONSi where the number N of products is large (say 100 products). How can I program easily a total consumption equation as the sum of all of these?- ie is there some function that I can use in a model equation to write something like :
mymodel.append CONS=sum(CONSi)
and if N is large, is there a risk that the resulting equation might be "truncated" in the model code? I have seen the @rsum discussion and am not sure whether it applies to my problem (ie what happens at model solve?).
Thanks in advance for any help.
Bernardg
model equation defining sum of large number of variables
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: model equation defining sum of large number of variables
Normally RSUM would work, but in a model it will not - the model will not be able to parse and expand the group to get the dynamics/interactions of the series inside it.
Your only choice is to write out the sum long form. In a program it isn't too bad. Something like (assuming you have the 100 series in a group called CONSi):
Your only choice is to write out the sum long form. In a program it isn't too bad. Something like (assuming you have the 100 series in a group called CONSi):
Code: Select all
%expr = consi.@seriesname(1)
for !i=2 to consi.@count
%expr = %expr + "+" + consi.@seriesname(!i)
next
mymodell.append CONS={%expr}
Re: model equation defining sum of large number of variables
Thanks so much for this, Gareth. I will try and use this.
Who is online
Users browsing this forum: No registered users and 1 guest
