Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix in Penn World Table unit conversion #67

Merged
merged 1 commit into from
Apr 3, 2023
Merged

bugfix in Penn World Table unit conversion #67

merged 1 commit into from
Apr 3, 2023

Conversation

orichters
Copy link
Contributor

  • REMIND shows unintended capital / consumption jumps between 2005 and 2015, see this remindmodel issue
  • analyzing AMT runs, it was found this changed between November and beginning of December while switching from cfg$inputRevision <- "6.316" to "6.324" as visible in this comparison
  • Michaja found that calcCapital() results differ between 1242136 and 298465a, see this mrremind issue
  • I think responsible is this PR in mrdrivers which adds to calcInternalGDPPastPWT() the following line:
data <- GDPuc::convertGDP(data, "constant 2017 Int$PPP", unit, replace_NAs = c("linear", "no_conversion"))

PENN World Table data is read from this file called /p/projects/rd3mod/inputdata/sources/PWT/pwt80.xlsx, which states:

rgdpna: Real GDP at constant 2005 national prices (in mil. 2005US$)

I think this data must not be converted from 2017 to 2005 data, and the PR description does not provide a rationale why this change was intended. Therefore, I suggest to revert this change.

@@ -1,796 +0,0 @@
# Default calcOutput Population calls
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea why buildLibrary deleted this file…

@0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q
Copy link
Member

Anybody made new input data to

  1. confirm this fixes the bug
  2. confirm this does not introduce "unwanted behaviour" somewhere else?

@orichters
Copy link
Contributor Author

Lavinia started input generation yesterday and we will check the results.

@0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q
Copy link
Member

Looks good.

$ tar -Oxf /p/projects/rd3mod/inputdata/output/rev6.47_62eff8f7_remind.tgz ./f29_capitalQuantity.cs4r | grep "20[01].,EUR,gdp_SSP2EU,kap,"
2000,EUR,gdp_SSP2EU,kap,37.824154
2005,EUR,gdp_SSP2EU,kap,45.493689
2010,EUR,gdp_SSP2EU,kap,47.917582
2015,EUR,gdp_SSP2EU,kap,50.561141

@mleimbach
Copy link

Oli, can you double check. For REF I see these input numbers, which are higher than what we have before:
tar -Oxf /p/projects/rd3mod/inputdata/output/rev6.47_62eff8f7_remind.tgz ./f29_capitalQuantity.cs4r | grep "20[01].,REF,gdp_SSP2EU,kap,"
2000,REF,gdp_SSP2EU,kap,10.074331
2005,REF,gdp_SSP2EU,kap,9.44623
2010,REF,gdp_SSP2EU,kap,11.412844
2015,REF,gdp_SSP2EU,kap,12.458628

@orichters
Copy link
Contributor Author

Well, this was the change from 6.316 to 6.324, reflecting the difference between Nov-26 and Dec-03 AMT runs:

> tar -Oxf /p/projects/rd3mod/inputdata/output/rev6.316_62eff8f7_remind.tgz ./f29_capitalQuantity.cs4r | grep "20[01].,REF,gdp_SSP2EU,kap,"
2000,REF,gdp_SSP2EU,kap,9.997588
2005,REF,gdp_SSP2EU,kap,9.382936
2010,REF,gdp_SSP2EU,kap,11.336092
2015,REF,gdp_SSP2EU,kap,12.446041
> tar -Oxf /p/projects/rd3mod/inputdata/output/rev6.324_62eff8f7_remind.tgz ./f29_capitalQuantity.cs4r | grep "20[01].,REF,gdp_SSP2EU,kap,"
2000,REF,gdp_SSP2EU,kap,15.941333
2005,REF,gdp_SSP2EU,kap,14.905243
2010,REF,gdp_SSP2EU,kap,17.731448
2015,REF,gdp_SSP2EU,kap,19.179349

So we are basically back to the old results, which I think is fine. I don't understand where the small difference to 6.47 comes from, but the difference is less than 1%.

@0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q
Copy link
Member

Rplot

@mleimbach
Copy link

How are these numbers related to what I would get when I plot from the fulldata.gdx (which also correpond to your plots in the macro group chat):

1 SSP2EU-AMT-Base_2022-11-26 REF 2005 3.54 kap quantity
2 SSP2EU-AMT-Base_2022-12-03 REF 2005 5.72 kap quantity
3 SSP2EU-AMT-Base_2022-11-26 REF 2010 4.27 kap quantity
4 SSP2EU-AMT-Base_2022-12-03 REF 2010 6.80 kap quantity
5 SSP2EU-AMT-Base_2022-11-26 REF 2050 11.6 kap quantity
6 SSP2EU-AMT-Base_2022-12-03 REF 2050 17.4 kap quantity

@orichters
Copy link
Contributor Author

My suspicion: MER vs PPP, done in this conversion here, where the capital factor from the input data is multiplied with 0.384747 for REF to get the data used by REMIND. And 9.382936 * 0.384747 = 3,61006, and then some specific capital stocks for industry etc. are subtracted, yielding the 3.54 value.

@mleimbach
Copy link

Thanks Oli. Right, input data are in PPP and REMIND data in MER...
It's just not to overlook something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants