Dear community,
I am modeling with the DICE2016 model of Nordhaus, which code is publicly available here; http://www.econ.yale.edu/~nordhaus/homepage/homepage/DICE2016R-091916ap.gms.
and I desperately need help as I am very inexperienced in GAMS (and time constrained).
Here are 2 (somewhat related) questions;
- I wish to model uncertainty in an altered version of the DICE model, (initially) through one parameter at the time, such as the initial growth rate of TFP, “ga0”. I believe the best way to do this is to import an Excel sheet with 10,000 MC-drawn values of ga0 to GAMS, before looping over these scenarios.
Here is my code;
**Karo tries random generation of ga0
set sc scenarios ;
* scenario set implicitly defined via parameter ga0_s
parameter ga0_s(sc<);
$onecho > file.1.txt
dset=sc rng=a1 rdim=1
par=ga0_s rng=Sheet2!a1 rdim=0 cdim=1
$offecho
* read data from excel and store in GDX file
$call GDXXRW Indata.xlsx trace=3 @file.1.txt
$ife errorlevel<>0 $abort Problem with GDXXRW
* load data from gdx file
$gdxin Indata
$load ga0_s
$gdxin
display sc, ga0_s;
parameter report(*,*,*) report parameter
* loop over scenarios and updata data as needed
loop(sc,
ga0 = ga0_s(sc);
* update other symbols if there are any in the model that depend ga0
ga(t)=ga0*exp(-dela*5*((t.val-1)));
al("1") = a0; loop(t, al(t+1)=al(t)/((1-ga(t))););
solve co2 maximizing utility using nlp;
report('scc',t,sc) = -1000*eeq.m(t)/(.00001+cc.m(t));
);
execute_unload 'try1.2.gdx' report;
execute 'gdxxrw try1.2.gdx par=report rdim=2 cdim=1' ;
abort$(errorlevel<>0) 'problems wirth GDXXRW';
Could someone kindly help me how to specify this, as my output seem to report all the scenarios as one run, and I get several error codes?
- Assuming that I am able to run the model 10,000 times with the different ga0-parameters, I then want to report the output in Excel-format (SCC(t), consumption per capita (t) etc.). Since the runs are so many I wish to tell GAMS to report the output in 100 (smaller) xlsx-files, showing 100 scenarios each, and then compiling them to one additional large one with all the scenarios. I would preferably have both csv- and xlsx-files.
How can I do that?
Please find my attached code, input and output.
Thank you so much in advance!
Kind regards!
Indata (1).xlsx (10.2 KB)
try1.2.xlsx (11 KB)
DICE2016.Altered TFP. Testing scenarios.gms (15.8 KB)