I am attempting to forecast a few variables (ratios) in a very simple manner - using a time trend and lag value of the variable. In the following code, a b c are groups with the variables in them. There are two requirements:
1. The forecasts of these variables (ratios) are constrained by the identity set out below. Basically, the ratios will sum up to 1. (Actually, I just realised that sum of the identity appears to be imposed, while some aren't. Is there a standard way of making sure the ratios sum up to 1 in the forecasts?)
2. The forecasts of these variables can't be negative. How can I go about setting up this constraint in the following code?
I had a look at this thread: viewtopic.php?t=48. But, I am still not entirely sure how to add in this non-negativity constraint in my case.
Code: Select all
for %g a b c
model shares_{%g}
for !i=1 to {%g}.@count
%1 = {%g}.@seriesname(!i)
equation eqxr{%1}.ls xr{%1} c @trend xr{%1}(-1)
shares_{%g}.merge eqxr{%1}
next
next
shares_a.append @identity asum = a1 + a2 + a3
shares_b.append @identity bsum = b1 + b2 + b3 + b4
shares_c.append @identity csum = c1 + c2 + c3 + c4 + c5
smpl July2014 July2050
for %g a b c
shares_{%g}.solve
next
Any help would be greatly appreciated. Thanks.