This data is from Tidy Tuesday. I am going to load the data up, it’s an S3 object then extract the data I want out to a data frame that is just the big mac data.
# A tibble: 6 × 20
date iso_a3 currency_code country local_price dollar_ex dollar_price
<date> <chr> <chr> <chr> <dbl> <dbl> <dbl>
1 2000-04-01 ARG ARS Argentina 2.5 1 2.5
2 2001-04-01 ARG ARS Argentina 2.5 1 2.5
3 2002-04-01 ARG ARS Argentina 2.5 3.13 0.799
4 2003-04-01 ARG ARS Argentina 4.1 2.88 1.42
5 2004-05-01 ARG ARS Argentina 4.36 2.95 1.48
6 2005-06-01 ARG ARS Argentina 4.75 2.90 1.64
# ℹ 13 more variables: usd_raw <dbl>, eur_raw <dbl>, gbp_raw <dbl>,
# jpy_raw <dbl>, cny_raw <dbl>, gdp_dollar <dbl>, adj_price <dbl>,
# usd_adjusted <dbl>, eur_adjusted <dbl>, gbp_adjusted <dbl>,
# jpy_adjusted <dbl>, cny_adjusted <dbl>, country_total <int>
Wow that is a lot to go through! There is about 16 years of data in here, and it seems like the data is pulled about once a week for each country. Let’s start by looking at the price of a big mac over time to track inflation.
big_mac %>%ggplot(aes(date, local_price, color = country)) +geom_line()
# A tibble: 27 × 2
country n
<chr> <int>
1 Argentina 33
2 Australia 33
3 Brazil 33
4 Britain 33
5 Canada 33
6 Chile 33
7 China 33
8 Czech Republic 33
9 Denmark 33
10 Euro area 33
# ℹ 17 more rows
Well, let’s look at all the countries that I have every data point for and see what I can find.
big_mac %>%filter(country_total ==max(country_total)) %>%ggplot(aes(date, local_price, color = country)) +geom_line()
This is still too many countries for it to be meaningful to have on one graph. Maybe I can find some cool insights if I take that data and facet wrap it by country, and force all the graphs to start at 0. Also I don’t like that country names is called name so I will change that to be something more useful.
big_mac %>%filter(country_total ==max(country_total)) %>%ggplot(aes(date, local_price, color = country)) +geom_line() +expand_limits( y =0) +facet_wrap(~ country, scales ="free_y") +labs(x ="Time",y ="Price in local currency") +theme(legend.position ="none")
This renders better on desktop than mobile, but this set of graphs represents inflation overtime. You can see that some countries have had periods of rapid inflation (Brazil), and other countries (Switzerland) haven’t had much inflation during the same period of time. I am going to sort this by the change in ratio of min and max to find the countries that had the most inflation.
big_mac %>%filter(country_total ==max(country_total)) %>%mutate(country =fct_reorder(country, local_price, function(.) max(.) /min(.))) %>%ggplot(aes(date, local_price, color = country)) +geom_line() +expand_limits( y =0) +facet_wrap(~ country, scales ="free_y") +labs(x ="Time",y ="Price of Big Mac in local currency") +theme(legend.position ="none")
By using the ratio I can find the steady ones versus the cones that went through the most inflation.
big_mac %>%filter(country_total ==max(country_total)) %>%group_by(country) %>%summarize(big_mac_inflation =last(local_price) /first(local_price)) %>%arrange(desc(big_mac_inflation)) %>%mutate(country =fct_reorder(country, big_mac_inflation)) %>%ggplot(aes(big_mac_inflation, country)) +geom_col() +geom_text(aes(label =paste0(round(big_mac_inflation, 1), "X")), hjust =0) +scale_x_log10(breaks =c(1, 3, 10, 30, 100)) +labs(x ="Price of Big Mac in 2020 / Price of Big Mac in 2000")
And here I was thinking that inflation in the US was bad! The big mac price only increased 2.3x in 20 years in the US, versus 7.1x in Brazil and over 100 times in Argentina. I wish that I was able to get a 2024 data set as I know the prices recently across the US have risen. The most recent is July 2023, so maybe I’ll load that data in next to see what is going on with it.
I want to look at the raw index to see how prices globally compare to the US price.
So looking at this, the usd_raw = (big_mac_ex - dollar_ex) / dollar_ex so we are looking for the smallest value here as that will tell us which currencies are the most undervalued compared to the dollar.
big_mac %>%filter(country_total ==max(country_total), country !="United States") %>%select(date, country, local_price, dollar_ex, usd_raw, gdp_dollar, usd_adjusted) %>%filter(!is.na(gdp_dollar)) %>%ggplot(aes(date, usd_raw)) +geom_line() +geom_hline(color ="red", lty =2, yintercept =0) +expand_limits(y =0) +facet_wrap(~country) +theme(axis.text.x =element_text(angle =90, hjust =1)) +labs(y ="Big Mac Index relative to USD",x ="")
So in 2020 if I went to Argentina and exchanged my USD to local currency (for no fee) I could buy a lot more big macs that I would expect. Expanding this to all countries I can see that:
library(ggrepel)big_mac %>%filter(date ==max(date)) %>%ggplot(aes(gdp_dollar, usd_raw)) +geom_point() +geom_smooth(method ="lm") +geom_text_repel(aes(label = country)) +labs(x ="GDP per capita (dollars)",y ="Raw Big Mac Index relative to USD")
So in Indonesia, Big Macs are cheaper than expected based on the currency exchange rate, but Indonesia is on par with countries that have roughly the same GDP. What we’re really interested in are rich countries with cheap Big Macs, or relatively poor countries with expensive Big Macs which indicate currency is either under or over valued respectively.
library(ggrepel)big_mac %>%filter(date ==max(date)) %>%ggplot(aes(gdp_dollar, usd_adjusted)) +geom_point() +geom_smooth(method ="lm") +geom_text_repel(aes(label = country)) +labs(x ="GDP per capita (dollars)",y ="Adjusted Big Mac Index relative to USD")
big_mac %>%filter(date ==max(date)) %>%mutate(country =fct_reorder(country, usd_adjusted)) %>%ggplot(aes(usd_adjusted, country)) +geom_col() +labs(x ="Big Mac Index relative to USD (GDP-adjusted)",y ="")
big_mac %>%filter(country !="United States") %>%filter(!is.na(gdp_dollar)) %>%ggplot(aes(date, usd_adjusted)) +geom_line() +geom_hline(color ="red", lty =2, yintercept =0) +expand_limits(y =0) +facet_wrap(~country) +theme(axis.text.x =element_text(angle =90, hjust =1)) +labs(y ="Big Mac Index relative to USD",x ="")
So this adjustment looks at the Big Mac price over time compared to the usd_adjusted (calculation outlined above). The fact that so many of these hang around 0 indicates that McDonald’s does some sort of price adjustment based on the local GDP vs US GDP. I wonder if this is to prevent a secondary burger speculation market from appearing.