file | LAST_DOWNLOAD |
---|---|
FAAt101 | 2024-05-20 |
LAST_COMPILE |
---|
2024-05-20 |
date | Nobs |
---|---|
2022-12-31 | 24 |
FAAt101 %>%
year_to_date %>%
filter(LineNumber %in% c(2, 3)) %>%
rename(variable = LineDescription) %>%
left_join(gdp, by = "date") %>%
mutate(DataValue = DataValue / gdp,
variable = case_when(variable == "Fixed assets" ~ "Fixed assets (Private + Government)",
variable == "Private" ~ "Fixed assets (Private)")) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable)) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
minor_breaks = "5 years",
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*seq(0, 500, 20),
labels = scales::percent_format(accuracy = 1)) +
theme(legend.position = c(0.2, 0.9),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))
FAAt101 %>%
year_to_date %>%
filter(LineNumber %in% c(2, 3)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_A %>%
select(date, GDP = value), by = "date") %>%
mutate(DataValue = DataValue / GDP,
variable = case_when(variable == "Fixed assets" ~ "Fixed assets (Private + Government)",
variable == "Private" ~ "Fixed assets (Private)")) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable)) +
ylab("% of GDP") + xlab("") + theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
minor_breaks = "5 years",
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*seq(0, 500, 20),
labels = scales::percent_format(accuracy = 1)) +
theme(legend.position = c(0.7, 0.9),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))
FAAt101 %>%
year_to_date %>%
filter(LineNumber %in% c(5, 6, 8, 15)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_adjustment, by = "date") %>%
mutate(DataValue = `Real GDP / Real GDP Trend (Log Linear)` * DataValue / GDP) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable)) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
minor_breaks = "5 years",
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*seq(0, 160, 10),
labels = scales::percent_format(accuracy = 1)) +
scale_color_manual(values = viridis(5)[1:4]) +
theme(legend.position = c(0.2, 0.3),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))
FAAt101 %>%
year_to_date %>%
filter(LineNumber %in% c(5, 6, 8, 15)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_A %>%
select(date, GDP = value), by = "date") %>%
mutate(DataValue = DataValue / GDP) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable)) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
minor_breaks = "5 years",
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*seq(0, 160, 10),
labels = scales::percent_format(accuracy = 1)) +
theme(legend.position = c(0.8, 0.9),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))
FAAt101 %>%
year_to_date %>%
filter(LineNumber %in% c(1, 2)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_adjustment, by = "date") %>%
mutate(DataValue = `Real GDP / Real GDP Trend (Log Linear)` * DataValue / GDP) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable)) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
minor_breaks = "5 years",
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*seq(0, 400, 10),
labels = scales::percent_format(accuracy = 1)) +
scale_color_manual(values = viridis(3)[1:2]) +
theme(legend.position = c(0.25, 0.9),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))
FAAt101 %>%
year_to_date %>%
filter(LineNumber %in% c(1, 2)) %>%
rename(variable = LineDescription) %>%
left_join(gdp_A %>%
select(date, GDP = value), by = "date") %>%
mutate(DataValue = DataValue / GDP) %>%
ggplot + geom_line(aes(x = date, y = DataValue, color = variable)) +
ylab("% of GDP") + xlab("") +
theme_minimal()+
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1927-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = nber_recessions$Peak,
minor_breaks = "5 years",
labels = date_format("%y")) +
scale_y_continuous(breaks = 0.01*seq(0, 600, 50),
labels = scales::percent_format(accuracy = 1)) +
theme(legend.position = c(0.7, 0.9),
legend.title = element_blank(),
legend.text = element_text(size = 8),
legend.key.size = unit(0.9, 'lines'))
FAAt101 %>%
year_to_date %>%
mutate(year = year(date)) %>%
filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
group_by(year) %>%
mutate(DataValue = round(100*DataValue/DataValue[1], 1)) %>%
ungroup %>%
select(LineNumber, LineDescription, year, DataValue) %>%
spread(year, DataValue) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}
FAAt101 %>%
year_to_date %>%
mutate(year = year(date)) %>%
filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
group_by(year) %>%
mutate(DataValue = round(DataValue)) %>%
ungroup %>%
select(LineNumber, LineDescription, year, DataValue) %>%
spread(year, DataValue) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}