Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 1 year ago
Thanks, @0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q, very helpful!
This change in calcGDPPast() in mrdrivers seems to change old GDP numbers substantially:
library(tidyverse)
unit <- "constant 2005 Int$PPP"
rgdpna <- readSource("PWT")[, , "rgdpna"]
calcInternalGDPPastPWT <- function(unit) {
data <- rgdpna
data <- GDPuc::convertGDP(data, "constant 2017 Int$PPP", unit, replace_NAs = c("linear", "no_conversion"))
getNames(data) <- glue("gdp in {unit}")
list(x = data, weight = NULL, unit = "constant 2005 Int$PPP", description = "GDP from PWT")
}
calcInternalGDPPastPWTold <- function() {
data <- rgdpna
getNames(data) <- "GDP_PWT"
list(x = data, weight = NULL, unit = "constant 2005 Int$PPP", description = "GDP from PWT")
}
old <- quitte::as.quitte(calcInternalGDPPastPWTold())
new <- quitte::as.quitte(calcInternalGDPPastPWT())
> filter(as.quitte(old$x), region == "DEU", period > 2004)
# A tibble: 7 × 7
model scenario region variable unit period value
<fct> <fct> <fct> <fct> <fct> <int> <dbl>
1 (Missing) (Missing) DEU GDP_PWT (Missing) 2005 2614550
2 (Missing) (Missing) DEU GDP_PWT (Missing) 2006 2711288.
3 (Missing) (Missing) DEU GDP_PWT (Missing) 2007 2799922.
4 (Missing) (Missing) DEU GDP_PWT (Missing) 2008 2830250.
5 (Missing) (Missing) DEU GDP_PWT (Missing) 2009 2685143.
6 (Missing) (Missing) DEU GDP_PWT (Missing) 2010 2796784.
7 (Missing) (Missing) DEU GDP_PWT (Missing) 2011 2881496.
> filter(as.quitte(new$x), region == "DEU", period > 2004)
# A tibble: 7 × 7
model scenario region variable unit period value
<fct> <fct> <fct> <fct> <fct> <int> <dbl>
1 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2005 1.89e6
2 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2006 1.96e6
3 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2007 2.03e6
4 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2008 2.05e6
5 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2009 1.95e6
6 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2010 2.03e6
7 (Missing) (Missing) DEU gdp in constant 2005 Int$PPP (Missin… 2011 2.09e6
So I guess this might be the reason.
My suspicion:
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$)
So I don't think this data should be converted from 2017 to 2005 data. The PR does not show an explanation why this is the case, so I would rather revert this change.
Oliver, with conversion, GDP in 2005US$ becomes lower. I am still confused why we than see higher capital stocks (assuming that we apply the same capital intensity factors).
This line calculates the capital/GDP ratio based on PWT. If historical GDP is lower, then capital/GDP is higher. If you multiply that with your desired SSP2 GDP, you get a higher capital stock. So the error was in the calculation of the capital intensity factor which was inflated because of the bug.
Ok,capital intensity changes. Makes sense.
solved with https://github.com/pik-piam/mrdrivers/pull/67
Originates from remindmodel/remind#1276.
calcCapital()
https://github.com/pik-piam/mrremind/blob/8261c7f17bf31f5d602fe19f6f9233bc8634c411/R/calcCapital.R#L21-L28
https://github.com/pik-piam/mrremind/blob/8261c7f17bf31f5d602fe19f6f9233bc8634c411/R/calcCapital.R#L32
So it appears that 1242136 and 298465a used different "
gdpppp_hist
" for transforming capital intensities back into capital stocks. That, however, is not due to a change incalcCapital()
in that timeframe.mrdrivers
moved from 0.6.6 (pik-piam/mrdrivers#49) to 0.7.2 (pik-piam/mrdrivers#54) in the meantime, so maybe answers lie that way.