Skip to content

Commit

Permalink
limit price changes of pf druing calibration
Browse files Browse the repository at this point in the history
- limit the changes in prices for selected production factors to between
  0.5-2 of the price of the previous calibration iteration
- this might stabilise calibration behaviour against sudden price jumps
  • Loading branch information
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q committed Mar 18, 2024
1 parent 120f5c7 commit fc6bfd6
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
2 changes: 2 additions & 0 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,8 @@ $setglobal c_CES_calibration_new_structure 0 !! def = 0 !! regexp = 0|1
$setglobal c_CES_calibration_write_prices 0 !! def = 0 !! regexp = 0|1
*** cm_CES_calibration_default_prices <- 0.01 # def <- 0.01 lower value if input factors get negative shares (xi), CES prices in the first calibration iteration
$setglobal cm_CES_calibration_default_prices 0.01 !! def = 0.01
*** c29_in_limit_price_change sets production factors that have their price changes limited to a factor of two during calibration"
$setglobal c29_in_limit_price_change "ue_steel_primary, kap_steel_primary" !! def = ""
*** cm_calibration_string "def = off, else = additional string to include in the calibration name to be used" label for your calibration run to keep calibration files with different setups apart (e.g. with low elasticities, high elasticities)
$setglobal cm_calibration_string off !! def = off
*** cm_techcosts - use regionalized or globally homogenous technology costs for certain technologies
Expand Down
64 changes: 63 additions & 1 deletion modules/29_CES_parameters/calibrate/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,37 @@ if (smin((t,regi_dyn29(regi),ppf_29(in)), pm_cesdata(t,regi,in,"price")) le 0,
abort "Some ppf prices are <= 0. Check ./modules/29_CES_parameters/calibrate/input/pm_cesdata_price_XXX.inc!";
);

*** Limit changes in prices for susceptible pf
if (sum((t,regi_dyn29(regi),in_limit_price_change_29(ppf_29(in))),
(pm_cesdata(t,regi,in,"price") > 2 * p29_cesdata_load(t,regi,in,"price"))
+ (pm_cesdata(t,regi,in,"price") < 0.5 * p29_cesdata_load(t,regi,in,"price"))
),
put logfile, " " / "limiting pf price changes" /;
loop ((t,regi_dyn29(regi),in_limit_price_change_29(ppf_29(in))),
sm_tmp
= pm_cesdata(t,regi,in,"price")
/ p29_cesdata_load(t,regi,in,"price");

if (sm_tmp < 0.5 OR 2 < sm_tmp,
put pm_cesdata.tn(t,regi,in,"price"), " [",
p29_cesdata_load(t,regi,in,"price"), " -> ",
pm_cesdata(t,regi,in,"price"), "] -> ";

pm_cesdata(t,regi,in,"price")
= min(
max(
pm_cesdata(t,regi,in,"price"),
0.5 * p29_cesdata_load(t,regi,in,"price")
),
2 * p29_cesdata_load(t,regi,in,"price")
);

put pm_cesdata(t,regi,in,"price") /;
);
);
putclose logfile, " " /;
);

*** Write prices to file
if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration
put file_CES_calibration;
Expand Down Expand Up @@ -890,7 +921,38 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1"
*** c_CES_calibration_industry_FE_target == 1 means that
*** industry ppfen input prices are scaled to make the Euler identity hold

*** Abort if any industry EEK value is lower than subsector output quantity
*** Limit changes in prices for industry EEK
if (sum((t,regi_dyn29(regi),in_limit_price_change_29(ppfKap_industry_dyn37(in))),
(pm_cesdata(t,regi,in,"price") > 2 * p29_cesdata_load(t,regi,in,"price"))
+ (pm_cesdata(t,regi,in,"price") < 0.5 * p29_cesdata_load(t,regi,in,"price"))
),
put logfile, " " / "limiting pf price changes" /;
loop ((t,regi_dyn29(regi),in_limit_price_change_29(ppfKap_industry_dyn37(in))),
sm_tmp
= pm_cesdata(t,regi,in,"price")
/ p29_cesdata_load(t,regi,in,"price");

if (sm_tmp < 0.5 OR 2 < sm_tmp,
put pm_cesdata.tn(t,regi,in,"price"), " [",
p29_cesdata_load(t,regi,in,"price"), " -> ",
pm_cesdata(t,regi,in,"price"), "] -> ";

pm_cesdata(t,regi,in,"price")
= min(
max(
pm_cesdata(t,regi,in,"price"),
0.5 * p29_cesdata_load(t,regi,in,"price")
),
2 * p29_cesdata_load(t,regi,in,"price")
);

put pm_cesdata(t,regi,in,"price") /;
);
);
putclose logfile, " " /;
);

*** Abort if any industry EEK value is higher than subsector output quantity
sm_tmp = smin((t,regi_dyn29(regi),
cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))
),
Expand Down
5 changes: 5 additions & 0 deletions modules/29_CES_parameters/calibrate/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ eff_scale_par "parameters for scaling certain efficiencies during calibration"
CES_tp(all_in) "CES tree traversal pending nodes"
CES_ts(all_in) "CES tree traversal swap node"
/ /

in_limit_price_change_29(all_in) "production factors that have their price changes limited to a factor of two during calibration"
/
%c29_in_limit_price_change%
/
;

alias(cesOut2cesIn_below,cesOut2cesIn_below2);
Expand Down

0 comments on commit fc6bfd6

Please sign in to comment.