I was trying to use priceR::adjust_for_inflation to convert US GDP values from current USD to constant 2010 USD. However, comparison with World Bank data shows that my results are way off. I wonder if this is an issue with the function or just me applying it in a way I shouldn't? I was able to manually deflate the GDP values though.
For reference, I downloaded the US GDP series in both current and constant 2010 USD from WDI. The World Bank uses GDP deflators rather than the CPI so I download both as well. Focusing on the US should eliminate any exchange rate complications.
library(tidyverse)
library(priceR)
# download data from World Bank
wdi <- WDI::WDI(
country = "US",
indicator = c("constant" = "NY.GDP.MKTP.KD",
"current" = "NY.GDP.MKTP.CD",
"gdp_deflator" = "NY.GDP.DEFL.KD.ZG",
"cpi_deflator" = "FP.CPI.TOTL.ZG"
),
start = 1970,
end = 2017) %>%
select(!iso2c:country) %>%
as_tibble() %>%
haven::zap_label()
Naively applying priceR::adjust_for_inflation does not seem to work here:
I was trying to use
priceR::adjust_for_inflation
to convert US GDP values from current USD to constant 2010 USD. However, comparison with World Bank data shows that my results are way off. I wonder if this is an issue with the function or just me applying it in a way I shouldn't? I was able to manually deflate the GDP values though.For reference, I downloaded the US GDP series in both current and constant 2010 USD from WDI. The World Bank uses GDP deflators rather than the CPI so I download both as well. Focusing on the US should eliminate any exchange rate complications.
Naively applying
priceR::adjust_for_inflation
does not seem to work here:I then tried to exchange the
inflation_dataframe
(which apparently uses CPI) with GDP deflators but the results are almost unchanged:Any help is greatly appreciated!