edit/override of identity
Posted: Wed Jan 09, 2019 8:46 am
Hello,
I have a short program that compiles and solves a model for energy prices.
It forecasts a real price, and then inflates it using a GDP deflator to create a nominal price. I would like to make adjustments to the nominal price (identity) directly using the "edit/override" function. Is this possible? Currently, when I edit/override --> make changes --> reinclude --> resolve the nominal price series gets very wonky and goes negative.
Thanks,
Bob
here is the model code for reference:
wfcreate HHData m 2011 2050
%fstart = "2019m1"
pagerename untitled data
wfopen ngbdata
copy ngbdata::usdm\deflatoryrus HHData::data\df
wfclose ngbdata
'import data
import c:\warem32\HHModData.xlsx range="Independent" @freq m 2011
import c:\warem32\HHModData.xlsx range="HHPrice" @freq m 2011
'create model object
model HHPMod
'equation
smpl 2015 2050
equation HHPeq.ls(h) hhprice usdmnd usl48sd @expand(month, @drop(11), @drop(12)) ar(1) ar(3) ar(5) ar(8)
HHPMod.append @identity HHPN = HHPrice*DF
'merging
HHPmod.merge HHPeq
'solve
smpl %fstart 2050m12
HHPMOD.solveopt(s=d,d=d,m=4000,c=1e-8,a=f,o=g,i=a,n=t,e=t,g=n,z=1e-7,f=t,v=f,j=a)
solve HHPMOD
HHPMOD.scenario(n) "Adjust"
HHPMOD.scenario(a=_1) "Adjust"
smpl %fstart 2050M12
solve HHPMOD
'setting up for adjustments
%n = HHPMOD.@stochastic
HHPMOD.addassign(v) {%n}
HHPMOD.addinit(s=a,v=z) {%n}
%o =HHPMOD.@stochastic
%p = @wcross(%o,"_a")
%q = @wcross(%p,"_1")
for %j {%q}
!i = @isobject(%j)
if(!i = 1) then
delete {%j}
endif
next
HHPMOD.override {%p}
HHPMOD.addinit(v=z,s=o) {%o}
'!...Run A "Regular Solve"
smpl %fstart 2050m12
solve HHPMOD
%n = HHPMOD.@stochastic
HHPMOD.exclude(r) {%n}
HHPMOD.addinit(s=a,v=a) {%n}
solve HHPMOD
HHPMOD.override(r) {%n}
solve HHPMOD
statusline Done With Model Creation/Setup
I have a short program that compiles and solves a model for energy prices.
It forecasts a real price, and then inflates it using a GDP deflator to create a nominal price. I would like to make adjustments to the nominal price (identity) directly using the "edit/override" function. Is this possible? Currently, when I edit/override --> make changes --> reinclude --> resolve the nominal price series gets very wonky and goes negative.
Thanks,
Bob
here is the model code for reference:
wfcreate HHData m 2011 2050
%fstart = "2019m1"
pagerename untitled data
wfopen ngbdata
copy ngbdata::usdm\deflatoryrus HHData::data\df
wfclose ngbdata
'import data
import c:\warem32\HHModData.xlsx range="Independent" @freq m 2011
import c:\warem32\HHModData.xlsx range="HHPrice" @freq m 2011
'create model object
model HHPMod
'equation
smpl 2015 2050
equation HHPeq.ls(h) hhprice usdmnd usl48sd @expand(month, @drop(11), @drop(12)) ar(1) ar(3) ar(5) ar(8)
HHPMod.append @identity HHPN = HHPrice*DF
'merging
HHPmod.merge HHPeq
'solve
smpl %fstart 2050m12
HHPMOD.solveopt(s=d,d=d,m=4000,c=1e-8,a=f,o=g,i=a,n=t,e=t,g=n,z=1e-7,f=t,v=f,j=a)
solve HHPMOD
HHPMOD.scenario(n) "Adjust"
HHPMOD.scenario(a=_1) "Adjust"
smpl %fstart 2050M12
solve HHPMOD
'setting up for adjustments
%n = HHPMOD.@stochastic
HHPMOD.addassign(v) {%n}
HHPMOD.addinit(s=a,v=z) {%n}
%o =HHPMOD.@stochastic
%p = @wcross(%o,"_a")
%q = @wcross(%p,"_1")
for %j {%q}
!i = @isobject(%j)
if(!i = 1) then
delete {%j}
endif
next
HHPMOD.override {%p}
HHPMOD.addinit(v=z,s=o) {%o}
'!...Run A "Regular Solve"
smpl %fstart 2050m12
solve HHPMOD
%n = HHPMOD.@stochastic
HHPMOD.exclude(r) {%n}
HHPMOD.addinit(s=a,v=a) {%n}
solve HHPMOD
HHPMOD.override(r) {%n}
solve HHPMOD
statusline Done With Model Creation/Setup