openmodels / MimiPAGE2020.jl

PAGE-2020 - a Julia implementation of the PAGE Integrated Assessment Model
MIT License
8 stars 10 forks source link

Update the Mimi-PAGE Monte Carlo #36

Closed jrising closed 5 years ago

jrising commented 5 years ago

This currently just adds in random sampling for the ampf parameter, but will also be the branch for updating the MC code in general.

jrising commented 5 years ago

@jkikstra I added in the amplification factors here. I'll test them as part of the whole system later.

jrising commented 5 years ago

@P-Wlich @fhdezram The MC system works now for me. I haven't plotted out the results try it out and let me know what you find. The semantics are that you load src/mcs.jl in Julia, and run do_monte_carlo_runs(N) for N as the number of random draws. That then outputs a file for each saved variable (the list of variables is in the save call) in the output directory, and then also a file mimipagemontecarlooutput.csv which outputs one region-year combination for each variable. That's currently set to Latin America in 2200, but change that in src/utils/mctools.jl.

Let me know if it's working and I'll merge it in. Thanks!

pwaidelich commented 5 years ago

This is great, thank you so much! I plotted present-value impacts against temperatures, rate of time preference and our Burke coefficient as well as a histogram of the present-value effect (incl. adaptation and mitigation costs), with OLS lines in blue. Looks all good to me. grafik

pwaidelich commented 5 years ago

@jrising Could we implement the new compute_scc() function into the MC code (with default settings) and make it a part of the default output? I don't understand the MC code well enough to have a go at it myself but if you give me a brief instruction how this could/should be done, I'll try

jrising commented 5 years ago

@P-Wlich I've merged in the compute_scc code and added a new function to mcs.jl called get_scc_mcs. But it's not giving reasonably scaled values yet, and I haven't tracked down why. Feel free to test it though, if you want:

include("mcs.jl")
include("compute_scc.jl")
get_scc_mcs(100, 2020)
pwaidelich commented 5 years ago

Thanks. I've looked at it and I guess we have to rescale the differences in td_totaldiscountedimpacts between the marginal and the base model in my_scc_calculation with the size of the emission pulse. I've first tried something like this scc_results[trialnum] = (marginal[:EquityWeighting, :td_totaldiscountedimpacts] - base[:EquityWeighting, :td_totaldiscountedimpacts]) / (marginal[:co2emissions, :e_globalCO2emissions][1] - base[:co2emissions, :e_globalCO2emissions][1]) This is based on the idea that the emissions pulse is the difference of emissions in the first year (at least for the SCC for 2020 emissions), but gives results that look like the ones I got for my growth effects (median around $1200). So there must be something wrong with this approach. Therefore, I tried the following: scc_results[trialnum] = (marginal[:EquityWeighting, :td_totaldiscountedimpacts] - base[:EquityWeighting, :td_totaldiscountedimpacts]) / pulse_size This gives a median around 200 for one MCS with 500 runs, with the following distribution: grafik I haven't thought it through yet, though.

jrising commented 5 years ago

Yes, that's the problem. By the way, the proper divisor is pulse_size, and not the difference in observed emissions, because the timesteps aren't equal to a year (so the pulse is 5x the difference in the step 1 emissions). The SCC is surprisingly high though-- can we share your last graph there with Dmitry and see if he has thoughts on it? I'll merge this in.

pwaidelich commented 5 years ago

Great, this might explain why my manual computations were so far off as my results were ~5x higher. I could email Dmitry about the SCC this weekend as I wanted to get back to him about my growth effect stuff, anyways. But as the deterministic SCC is at $184 for the master branch, at least it does not seem to be an issue with the MC code.