This assignment utilizes the Big mac data set that is uploaded on the Tidytuesday in 22nd of December 2020 .The Big Mac index, created by The Economists in 1986, is an informal way to measure purchasing power parity (PPP) between countries. It is based on the idea that a Big mac (a globally standardized product) should have the same price when converted into a common currency if exchange rates reflect true differences in purchasing power. This data set starts from 2000 until 2020 and consists of around 50 countries information.(“https://github.com/rfordatascience/tidytuesday/tree/main/data/2020/2020-12-22”)
big_mac$date <- as.character(big_mac$date)
big_mac$date <- as.Date(big_mac$date, format = "%m/%d/%Y")
head(big_mac)
## date iso_a3 currency_code name local_price dollar_ex
## 1 2000-04-01 ARG ARS Argentina 2.50 1.00
## 2 2000-04-01 AUS AUD Australia 2.59 1.68
## 3 2000-04-01 BRA BRL Brazil 2.95 1.79
## 4 2000-04-01 CAN CAD Canada 2.85 1.47
## 5 2000-04-01 CHE CHF Switzerland 5.90 1.70
## 6 2000-04-01 CHL CLP Chile 1260.00 514.00
## dollar_price usd_raw eur_raw gbp_raw jpy_raw cny_raw gdp_dollar adj_price
## 1 2.500000 -0.00398 0.05007 -0.16722 -0.09864 1.09091 NA NA
## 2 1.541667 -0.38579 -0.35246 -0.48645 -0.44416 0.28939 NA NA
## 3 1.648045 -0.34341 -0.30778 -0.45102 -0.40581 0.37836 NA NA
## 4 1.938776 -0.22758 -0.18566 -0.35417 -0.30099 0.62152 NA NA
## 5 3.470588 0.38270 0.45774 0.15609 0.25130 1.90267 NA NA
## 6 2.451362 -0.02336 0.02964 -0.18342 -0.11618 1.05023 NA NA
## usd_adjusted eur_adjusted gbp_adjusted jpy_adjusted cny_adjusted
## 1 NA NA NA NA NA
## 2 NA NA NA NA NA
## 3 NA NA NA NA NA
## 4 NA NA NA NA NA
## 5 NA NA NA NA NA
## 6 NA NA NA NA NA
In addition to the Big Mac data, population and gdp data are used, which is imported with the WDI package.
WDI <- WDI(indicator = c("gdp_ppp" = "NY.GDP.PCAP.PP.KD",
"pop" = "SP.POP.TOTL",
"gdp_per_capita" = "NY.GDP.PCAP.KN"),
start = 2020, end = 2020)
#Adding continent data using the iso3c country code.
WDI$continent <- countrycode(WDI$iso3c, origin = "iso3c", destination = "continent")
## Warning: Some values were not matched unambiguously: , AFE, AFW, ARB, CEB, CHI, CSS, EAP, EAR, EAS, ECA, ECS, EMU, EUU, FCS, HPC, IBD, IBT, IDA, IDB, IDX, LAC, LCN, LDC, LMY, LTE, MEA, MIC, MNA, NAC, OED, OSS, PRE, PSS, PST, SAS, SSA, SSF, SST, TEA, TEC, TLA, TMN, TSA, TSS, WLD, XKX
head(WDI)
## country iso2c iso3c year gdp_ppp pop
## 1 Afghanistan AF AFG 2020 2769.686 39068979
## 2 Africa Eastern and Southern ZH AFE 2020 3861.111 694446100
## 3 Africa Western and Central ZI AFW 2020 4622.731 474569351
## 4 Albania AL ALB 2020 14650.396 2837849
## 5 Algeria DZ DZA 2020 14194.156 44042091
## 6 American Samoa AS ASM 2020 NA 49761
## gdp_per_capita continent
## 1 35568.86 Asia
## 2 NA <NA>
## 3 NA <NA>
## 4 525475.33 Europe
## 5 176992.30 Africa
## 6 12841.38 Oceania
Merging the big_mac and the WDI data sets.
big_mac_2020 <- big_mac[big_mac$date=="2020-07-01", ]
big_mac_2020 <- merge(big_mac_2020, WDI, by.x = "iso_a3", by.y = "iso3c", all.x = TRUE)
The law of one price says that identical goods (e.g., big mac) should have the same price after adjusting for exchange rates. However, this doesn’t always hold in the practice. The following graph shows the price of a Big Mac in USD across different countries in 2020. Switzerland has the most expensive Big Mac At $6.9, followed by Lebanon ($5.95), Sweden ($5.76), and United States ($5.71). On the other hand, Saudi Arabia had the cheapest Big Mac at 1.86, followed by Argentina ($1.91) and South Africa ($2.03).
ggplot(big_mac_2020, aes(x=reorder(name, dollar_price), y=dollar_price)) +
geom_bar(stat = "identity", fill = "#43a2ca") +
coord_flip() +
labs(
x = "Country",
y = "Price in USD",
title = "Big Mac Price by Country") +
theme_gray() + theme(
plot.title = element_text(hjust = 0.5)
)
The USD raw index is based on purchasing-power parity (PPP), which suggests exchange rates are determined by the value of goods, like Big Macs, that currencies can buy. By comparing local prices to the US price, we can estimate how much a currency is under- or over-valued relative to the USD.
The graph below illustrates how much currencies were under- or over-valued against the USD as of 2020. It shows that only three currencies (SEK, LBP, and CHF) were over-valued relative to the USD. Notably, currencies of major economies were under-valued: the Chinese yuan was 45.7% undervalued, the Japanese yen 36.3%, the euro 16.1%, and the British pound 25.1%.
ggplot(big_mac_2020, aes(x=reorder(currency_code, usd_raw), y=usd_raw)) +
geom_point(stat = "identity", aes(color = ifelse(usd_raw < 0, "blue", "red"))) +
geom_hline(yintercept=0) +
geom_linerange(aes(x=currency_code, ymin = 0, ymax = usd_raw, color = ifelse(usd_raw < 0, "blue", "red"))) +
labs(
x = "Currency",
y = "USD raw index",
title = "Raw index by Country") +
theme_classic() + theme(
plot.title = element_text(hjust = 0.5),
legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)
) +
geom_text(data = data.frame(x = c("ILS", "JOD", "JPY", "GBP"),
y = c(-0.18, -0.48, -0.39, -0.28),
label = c("EUR", "CNY", "JPY", "GBP")),
aes(x = x, y = y, label = label), color = "black", size = 3)
The main criticism of the raw Big Mac Index is that it does not account for the prices of non-tradable goods, such as wages, rents, and local services, which can vary significantly across countries. The prices of these goods tend to be higher in high-income countries, as shown in the following graph. It illustrates a strong positive correlation between the Big Mac raw index and GDP per capita.
big_mac_2020_clean <- big_mac_2020 %>% drop_na(c(pop, gdp_dollar))
ggplot(big_mac_2020_clean,
aes(x=gdp_dollar, y=dollar_price, size = pop, color = continent)) +
geom_point(alpha = 0.7) +
theme_bw() + labs(
x = "GDP per capita in USD",
y = "Big mac price in USD",
title = "GDP vs Big mac price") +
theme(plot.title = element_text(hjust = 0.5)) +
geom_text(hjust = 0, nudge_x = 0.5, size = 3, aes(label = name)) +
guides(size = "none") +
scale_size_continuous(range = c(3, 10)) +
scale_color_manual(values = c("Africa" = "#6e016b", "Asia" = "#005a32",
"Europe" = "#034e7b", "Americas" = "#99000d",
"Oceania" = "#8c2d04"))
The GDP-adjusted index addresses the criticism that burger prices are typically cheaper in poorer countries due to lower labor costs. This index presents a different picture than the raw index: 11 countries’ currencies are over-valued, compared to only 3 in the raw index.
big_mac_adj <- big_mac_2020 %>% drop_na(usd_adjusted)
ggplot(big_mac_adj, aes(x=reorder(currency_code, usd_adjusted), usd_adjusted)) +
geom_point(stat = "identity", aes(color = ifelse(usd_adjusted < 0, "blue", "red"))) +
geom_hline(yintercept=0) +
geom_linerange(aes(x=currency_code, ymin = 0, ymax = usd_adjusted
, color = ifelse(usd_adjusted < 0, "blue", "red"))) +
labs(
x = "Currency",
y = "USD adjusted index",
title = "GDP adjusted index") +
theme_classic() + theme(
plot.title = element_text(hjust = 0.5),
legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)
) +
geom_text(data = data.frame(x = c("EUR", "CNY", "JPY", "GBP"),
y = c(0.05, -0.09, -0.25, -0.13),
label = c("EUR", "CNY", "JPY", "GBP")),
aes(x = x, y = y, label = label), color = "black", size = 3)
big_mac_adjusted <- big_mac[big_mac$date >= 2011, ]
big_mac_adjusted <- big_mac_adjusted %>% drop_na(usd_adjusted)
big_mac_adjusted <- big_mac_adjusted[order(big_mac_adjusted$date), ]
ggplot(big_mac_adjusted, aes(x = date, y = name, fill = usd_adjusted)) +
geom_tile(color = "white") +
scale_fill_viridis_c(option = "plasma", name = "Adjusted Price (USD)") +
labs(
title = "Big Mac Index (Adjusted)",
x = "Date",
y = "Country",
fill = "USD Adjusted"
) +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
The euro’s overvaluation rose sharply against major currencies (CNY, JPY, GBP, and USD) between 2000 and 2010, peaking at nearly 200% overvaluation against the CNY in 2009. After 2010, this trend reversed, likely due to two factors: exchange rates adjusting toward the long-run equilibrium or prices in these countries rising significantly compared to the Euro zone.
big_mac_euro <- big_mac[big_mac$currency_code=="EUR", ]
ggplot(big_mac_euro, aes(x = date)) +
geom_line(aes(y = usd_raw), color = "#2ca25f") +
geom_line(aes(y = gbp_raw), color = "#756bb1") +
geom_line(aes(y = jpy_raw), color = "#d95f0e") +
geom_line(aes(y = cny_raw), color = "#de2d26") +
labs(title = "Euro exchange valuation",
x = "Date",
y = "Raw index"
) +
theme_classic() + theme(plot.title = element_text(hjust = 0.5)) +
geom_text(data = data.frame(x = as.Date(c("2020-01-01", "2010-01-01", "2009-01-01", "2020-01-01")),
y = c(-0.1, 1.7, 1, 0.2),
label = c("USD", "CNY", "JPY", "GBP"),
color = c("#2ca25f", "#de2d26", "#d95f0e", "#756bb1")),
aes(x = x, y = y, label = label, color=label), size = 3) +
scale_color_manual(values = c("USD" = "#2ca25f", "CNY" = "#de2d26",
"JPY" = "#d95f0e", "GBP" = "#756bb1"))
big_mac_europe <- big_mac_europe[order(big_mac_europe$date), ]
ggplot(big_mac_europe, aes(x=date, y=usd_raw, col = factor(name))) +
geom_line() + facet_wrap(~name) +
theme(legend.position = "none") +
theme_bw() +
labs(
title = "Europe",
y = "USD raw index",
x = "Date"
) +
theme(plot.title = element_text(hjust = 0.5))
ggplot(big_mac_asia, aes(x=date, y=usd_raw, col = factor(name))) +
geom_line() + facet_wrap(~name) +
theme(legend.position = "none") +
theme_bw() +
labs(
title = "Asia",
y = "USD raw index",
x = "Date"
) +
theme(plot.title = element_text(hjust = 0.5))
ggplot(big_mac_amer, aes(x=date, y=usd_raw, col = factor(name))) +
geom_line() + facet_wrap(~name) +
theme(legend.position = "none") +
theme_bw() +
labs(
title = "America",
y = "USD raw index",
x = "Date"
) +
theme(plot.title = element_text(hjust = 0.5))
ggplot(big_mac_oce, aes(x=date, y=usd_raw, col = factor(name))) +
geom_line() + facet_wrap(~name) +
theme(legend.position = "none") +
theme_bw() +
labs(
title = "Oceania",
y = "USD raw index",
x = "Date"
) +
theme(plot.title = element_text(hjust = 0.5))
ggplot(big_mac_af, aes(x=date, y=usd_raw, col = factor(name))) +
geom_line() + facet_wrap(~name) +
theme(legend.position = "none") +
theme_bw() +
labs(
title = "Africa",
y = "USD raw index",
x = "Date"
) +
theme(plot.title = element_text(hjust = 0.5))