Commit 1ae0cc1e authored by Thomas Brand's avatar Thomas Brand

Adapted IMF download to new format of url.

parent 08677294
......@@ -289,11 +289,10 @@ loans_hh <-
To build long series of lending rate, we use historical data from the International Finance Statistics of the IMF. Historical series will be used before 2000, because such series is available from ECB since 2000Q1. So we consider only countries among the first 12 Euro area members. Among them, four have very partial series. Eventually, we consider data only for : Belgium, Finland, France, Germany, Ireland, Italy, Netherlands and Spain. As in the methodology of AWM, we weigth the sum of the lending rates by the gross domestic product based on purchasing-power-parity (PPP) of each country in 1995, from the World Economic Outlook of the IMF.
```{r}
# Download lending rates of the 8 countries from IFS
country_code <- c("124","132","134","136","138","172","178","184")
country_code <- c("BE","FR","DE","IT","NL","FI","IE","ES")
url_country <- paste0(country_code, collapse = "+")
url <- paste0(url_widukind,"/IMF/data/IFS/0.",url_country,".Q.FILR-PA")
url <- paste0(url_widukind,"/IMF/data/IFS/Q.",url_country,".FILR-PA")
data_sdmx <- readSDMX(url)
df <- as.data.frame(data_sdmx)
......@@ -310,22 +309,28 @@ lendingrate_bycountry <- df %>%
# Download PPP GDP of the 8 countries from WEO
country_iso <- c("BEL","FRA", "DEU", "ITA", "NLD", "FIN", "IRL", "ESP")
url_country_iso <- paste0(country_iso, collapse = "+")
url <- paste0(url_widukind,"/IMF/data/WEO/PPPGDP.",url_country_iso,".5")
data_sdmx <- readSDMX(url)
df <- as.data.frame(data_sdmx)
df_country <- data.frame(country_code,
country=country_iso)
pppgdp <- df %>%
filter(TIME_PERIOD == 1995) %>%
select(`WEO-COUNTRY-CODE`,OBS_VALUE) %>%
rename(country = `WEO-COUNTRY-CODE`,
select(`ISO`,OBS_VALUE) %>%
rename(country = `ISO`,
values_pppgdp = OBS_VALUE) %>%
mutate(values_pppgdp = as.numeric(values_pppgdp))
mutate(values_pppgdp = as.numeric(values_pppgdp)) %>%
left_join(df_country,by="country") %>%
select(-country) %>%
rename(country=country_code)
sum_pppgdp <- sum(pppgdp$values_pppgdp)
# Merge databases and build a weighted mean
lendingrate_old <- left_join(lendingrate_bycountry, pppgdp, by = "country") %>%
lendingrate_old <-
left_join(lendingrate_bycountry, pppgdp, by = "country") %>%
transmute(time = time,
country = country,
values = values * values_pppgdp) %>%
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment