Add equity weighting option to compute scc function#40
Conversation
Codecov Report
@@ Coverage Diff @@
## master #40 +/- ##
==========================================
+ Coverage 89.47% 89.79% +0.32%
==========================================
Files 14 14
Lines 285 294 +9
==========================================
+ Hits 255 264 +9
Misses 30 30
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@davidanthoff and @FrankErrickson this (1) adds the option to use equity weighting for RICE SCC calculations (2) fixes some old documentation that indicated the default settings were constant discounting, while I believe they have already been changed to default to Ramsey discounting. |
FrankErrickson
left a comment
There was a problem hiding this comment.
I had a couple questions in the code. I didn't review some of the Mimi internal pieces too closely as I don't fully understand how all of it fits together for the scc function. I think the equity-weighted discount factors looked ok too, but always a good idea to have @davidanthoff just look over that equation really quickly.
|
|
||
| year_index = findfirst(isequal(year), model_years) | ||
|
|
||
| if isnothing(normalization_region) |
There was a problem hiding this comment.
Do we need this calculation? Couldn't we just index into the already calculated cpc terms from above using the year_index for the specified normalization region?
There was a problem hiding this comment.
@FrankErrickson you're right, we can probably simplify here by using the cpc from above, with something like the following.
cpc_0 = isnothing(normalization_region) ? mean(cpc[year_index, :]) : cpc[year_index, normalization_region]
| cpc_0 = 1000 * c[year_index, normalization_region] / pop[year_index, normalization_region] | ||
| end | ||
|
|
||
| df = zeros(year_index-1, num_regions) |
There was a problem hiding this comment.
Is this the correct size for df? If I added a pulse in 2010, year_index would be 6 I think? So now you would only have discount factors as a 5x12 array?
I think if you are only calculating discount factors for the periods after the pulse, you'd need something spanning from the year of pulse to the end of model time horizon. I'm not totally sure how you set up this internal SCC Mimi code. But in my own code, I would also just set discount factors to 0.0 for any periods before the pulse.
There was a problem hiding this comment.
In the deleted line 51 below, I think it essence were were starting with an array of zeros of length year_index-1 and then concatenating that with one value calculated for each year. I think this mimics that with arrays, starting with a zeros array which would be 5x12 for a year_index of 6 and then appending a set of discount factors, one per region, for each of the following years between year and last_year inclusive. I can probably do it more elegantly but does that make sense?
There was a problem hiding this comment.
Just for clarity the line I'm referring to is
df = [zeros(year_index-1)..., ((global_cpc[year_index]/global_cpc[i])^eta * 1/(1+prtp)^(t-year) for (i,t) in enumerate(model_years) if year<=t<=last_year)...]
No description provided.