Saving - saving

Data - Fred

Info

source dataset .html .RData
fred saving 2024-11-21 2024-11-22

Data on saving

source dataset .html .RData
bdf CFT 2024-11-21 2024-11-21
bea T50100 2024-02-11 2024-03-13
fred saving 2024-11-21 2024-11-22
oecd NAAG 2024-04-16 2024-03-13
wdi NY.GDS.TOTL.ZS 2022-09-27 2024-09-18
wdi NY.GNS.ICTR.ZS 2022-09-27 2024-09-18

LAST_COMPILE

LAST_COMPILE
2024-11-22

Last

date Nobs
2024-10-01 1

Variables - Javascript

Personal Saving Rate

Personal saving rate, saving rate

All

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1945-01-01"))

saving %>%
  filter(variable %in% c("PSAVERT", "A072RC1Q156SBEA")) %>%
  mutate(value = value / 100) %>%
  left_join(variable, by = "variable") %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal()  +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = as.Date(US_presidents_extract$start),
               labels = date_format("%Y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.05 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("Saving rate (%)") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

1999-

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1999-01-01"))

saving %>%
  filter(variable %in% c("PSAVERT", "A072RC1Q156SBEA")) %>%
  mutate(value = value / 100) %>%
  left_join(variable, by = "variable") %>%
  filter(date >= as.Date("1999-01-01")) %>%
  arrange(date) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal()  +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = c(seq(1999, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.05 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("Saving rate (%)") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Varying definitions

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1945-01-01"))

saving %>%
  filter(variable %in% c("PSAVERT", "W207RC1Q156SBEA", "W206RC1Q156SBEA")) %>%
  mutate(value = value / 100) %>%
  left_join(variable, by = "variable") %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal()  +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = as.Date(US_presidents_extract$start),
               labels = date_format("%Y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.05 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("Saving rate (%)") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Federal Saving (% of GDP), Fed Funds

All

Code
saving %>%
  filter(variable %in% c("FYFSGDA188S", "FEDFUNDS")) %>%
  filter(date >= as.Date("1953-01-01")) %>%
  mutate(value = value / 100) %>%
  left_join(variable, by = "variable") %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.4, 0.3)) +
  scale_x_date(breaks = as.Date(US_presidents_extract$start),
               labels = date_format("%Y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.27 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("%") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 20, 5),
                     labels = scales::percent_format(accuracy = 1),
                     limits = c(-0.27, 0.2)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = viridis(3)[2])

1960-2000

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1960-01-01"),
         start <= as.Date("2000-01-01"))

saving %>%
  filter(variable %in% c("FYFSGDA188S", "FEDFUNDS")) %>%
  filter(date >= as.Date("1960-01-01"),
         date <= as.Date("2000-01-01")) %>%
  mutate(value = value / 100) %>%
  left_join(variable, by = "variable") %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.4, 0.3)) +
  scale_x_date(breaks = as.Date(US_presidents_extract$start),
               labels = date_format("%Y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.19 + 0.01 * (1:n() %% 2)),
            size = 4, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("%") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 20, 5),
                     labels = scales::percent_format(accuracy = 1),
                     limits = c(-0.2, 0.2)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = viridis(3)[2])

Federal Saving

All

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1929-01-01"))

saving %>%
  filter(variable %in% c("FYFSD", "GDPA")) %>%
  mutate(date = date %>% year,
         date = as.Date(paste0(date, "-12-31"))) %>%
  spread(variable, value) %>%
  mutate(value = FYFSD / (GDPA*1000)) %>%
  filter(date >= as.Date("1929-01-01")) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.8)) +
  scale_x_date(breaks = as.Date(US_presidents_extract$start),
               labels = date_format("%y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.27 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("Budget Surplus (% of GDP)") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 6, 2),
                     labels = scales::percent_format(accuracy = 1),
                     limits = c(-0.27, 0.05)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = viridis(3)[2])

1947-2021

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1947-01-01"))

saving %>%
  filter(variable %in% c("FYFSD", "GDPA")) %>%
  filter(date >= as.Date("1947-01-01")) %>%
  mutate(date = date %>% year,
         date = as.Date(paste0(date, "-12-31"))) %>%
  spread(variable, value) %>%
  mutate(value = FYFSD / (GDPA*1000)) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.8)) +
  scale_x_date(breaks = as.Date(US_presidents_extract$start),
               labels = date_format("%y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.16 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("Budget Surplus (% of GDP)") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 6, 2),
                     labels = scales::percent_format(accuracy = 1),
                     limits = c(-0.16, 0.05)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = viridis(3)[2])

1947-2021

Code
US_presidents_extract <- US_presidents %>%
  filter(start >= as.Date("1999-01-01"))

saving %>%
  filter(variable %in% c("FYFSD", "GDPA")) %>%
  filter(date >= as.Date("1999-01-01")) %>%
  mutate(date = date %>% year,
         date = as.Date(paste0(date, "-01-01"))) %>%
  spread(variable, value) %>%
  mutate(value = FYFSD / (GDPA*1000)) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = value)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.8)) +
  scale_x_date(breaks = c(seq(1999, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  geom_vline(aes(xintercept = as.numeric(start)), 
             data = US_presidents_extract,
             colour = "grey50", alpha = 0.5) +
  geom_rect(aes(xmin = start, xmax = end, fill = party),
         ymin = -Inf, ymax = Inf, alpha = 0.1, data = US_presidents_extract) +
  geom_text(aes(x = start, y = new, label = name), 
            data = US_presidents_extract %>% mutate(new = -0.16 + 0.01 * (1:n() %% 2)),
            size = 2.5, vjust = 0, hjust = 0, nudge_x = 50) +
  # scale_fill_manual(values = viridis(3)[2:1]) +
  scale_fill_manual(values = c("white", "grey")) +
  xlab("") + ylab("Federal Saving (% of GDP)") +
  guides(color = guide_legend("party"), fill = FALSE) +
  scale_y_continuous(breaks = 0.01*seq(-30, 6, 2),
                     labels = scales::percent_format(accuracy = 1),
                     limits = c(-0.16, 0.05)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = viridis(3)[2])

Europe

Saving Rate

Code
ig_d("eurostat", "nasq_10_nf_tr", "B8G-B6G-FR-DE-IT-ES-1999")