annual_tfp %>%
filter(variable %in% c("dtfp", "dtfp_util")) %>%
left_join(variable, by = "variable") %>%
group_by(variable) %>%
mutate(value = value/100,
value_5Y = ((1+value)*(1+lag(value))*(1+lag(value, 2))*(1+lag(value, 3))*(1+lag(value, 4))*(1+lag(value, 5))*(1+lag(value, 6))*(1+lag(value, 7))*(1+lag(value, 8))*(1+lag(value, 9)))^(1/10)-1) %>%
na.omit %>%
ggplot + theme_minimal() + xlab("") + ylab("10-year previous TFP growth (%)") +
geom_line(aes(x = date, y = value_5Y, color = Variable)) +
scale_x_date(breaks = seq(1920, 2025, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*c(seq(-200, 100, 0.5)),
labels = scales::percent_format(accuracy = .1)) +
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1950-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
theme(legend.position = c(0.8, 0.9),
legend.title = element_blank()) +
scale_color_manual(values = viridis(3)[1:2])