CPI

shiller - Data

CPI

Linear

Code
nber_recessions_extract <- nber_recessions %>%
  filter(Peak >= as.Date("1871-01-01"))


plot_linear <- cpi %>%
  arrange(date) %>%
  mutate(CPI = 100*CPI / CPI[1]) %>%
  ggplot(.) + geom_line(aes(x = date, y = CPI)) + 
  ylab("") + theme_minimal() + xlab("") + 
  scale_x_date(breaks = as.Date(paste0(seq(1800, 2100, 20), "-01-01")),
               labels = date_format("%Y")) + 
  geom_rect(data = nber_recessions_extract, 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_y_continuous(breaks = c(100, 500, seq(100, 5000, 200))) +
  geom_vline(xintercept = as.Date("1933-04-20"), linetype = "dashed", color = viridis(3)[2])

plot_linear

Log

Code
plot_log <- plot_linear + 
  scale_y_log10(breaks = c(50, 100, 200, 500, 800, 1000, 2000)) +
  geom_vline(xintercept = as.Date("1933-04-20"), linetype = "dashed", color = viridis(3)[2]) + 
  geom_rect(data = nber_recessions_extract, 
            aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf), 
            fill = 'grey', alpha = 0.5)

plot_log

Bind

Code
ggpubr::ggarrange(plot_linear + ggtitle("Linear scale"), plot_log + ggtitle("Log scale"), common.legend = T)

CPI

1871-1940

Code
cpi %>%
  filter(date <= as.Date("1940-01-01")) %>%
  mutate(CPI = 100*CPI / CPI[date == as.Date("1923-01-01")]) %>%
  ggplot(.) + geom_line(aes(x = date, y = CPI)) + 
  ylab("U.S. Price Level (1871-1940)") + theme_minimal() + xlab("") + 
  scale_x_date(breaks = c(nber_recessions$Peak),
               labels = date_format("%y"),
               limits = c(1871, 1940) %>% paste0("-01-01") %>% as.Date) + 
  geom_rect(data = nber_recessions, 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_y_continuous(breaks = seq(30, 150, 10)) +
  geom_vline(xintercept = as.Date("1933-04-20"), linetype = "dashed", color = viridis(3)[2])

1920-1942

(ref:gold-standard-1920-1942) U.S. Prices (1920-1942)

Code
cpi %>%
  filter(date >= as.Date("1920-01-01"),
         date <= as.Date("1942-01-01")) %>%
  mutate(CPI = 100*CPI / CPI[date == as.Date("1923-01-01")]) %>%
  ggplot(.) + geom_line(aes(x = date, y = CPI)) + 
  ylab("Price Level") + theme_minimal() + xlab("") + 
  scale_x_date(breaks = c(nber_recessions$Peak, nber_recessions$Trough),
               labels = date_format("%y"),
               limits = c(as.Date("1920-01-01"), as.Date("1942-01-01"))) + 
  geom_rect(data = nber_recessions, 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_y_continuous(breaks = seq(50, 400, 5)) +
  geom_vline(xintercept = as.Date("1933-04-20"), linetype = "dashed", color = viridis(3)[2])

(ref:gold-standard-1920-1942)