Table 5.1. Saving and Investment by Sector (A) (Q)

Data - BEA

Info

source dataset .html .RData
bea T10105 2025-02-12 2025-02-12
bea T10106 2024-05-20 2025-02-12
bea T50100 2025-02-12 2025-02-12

Data on US macro

source dataset .html .RData
fred gdp 2025-01-26 2025-01-26
fred unr 2025-01-26 2025-01-26
oecd QNA 2024-06-06 2025-01-31
oecd SNA_TABLE1 2025-01-31 2025-01-31

LAST_COMPILE

LAST_COMPILE
2025-02-12

Last

date Nobs
2024-12-31 35

Layout

  • NIPA Website. html

Gross saving, Net saving, CCA

Code
T50100 %>%
  filter(FREQ == "A") %>%
  select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_A %>%
              mutate(table = "T10105")) %>%
  year_to_date %>%
  group_by(date) %>%
  mutate(value = DataValue/DataValue[LineNumber == 1 & table == "T10105"]) %>%
  filter(LineNumber %in% c(1, 2, 13) & table == "T50100") %>%
  ggplot(.) + theme_minimal() +
  geom_line(aes(x = date, y = value, color = LineDescription)) +
  theme(legend.title = element_blank(),
        legend.position = c(0.5, 0.15)) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1928-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_x_date(breaks = seq(1930, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  ylab("% of GDP") + xlab("") +
  
  scale_y_continuous(breaks = 0.01*seq(-100, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Gross saving, Gross investment

Code
T50100 %>% filter(FREQ == "A") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_A %>%
              mutate(table = "T10105")) %>%
  year_to_date %>%
  group_by(date) %>%
  mutate(value = DataValue/DataValue[LineNumber == 1 & table == "T10105"]) %>%
  filter(LineNumber %in% c(1, 21) & table == "T50100") %>%
  ggplot(.) + theme_minimal() + ylab("% of GDP") + xlab("") +
  geom_line(aes(x = date, y = value, color = LineDescription)) +
  theme(legend.title = element_blank(),
        legend.position = c(0.5, 0.15)) +
  
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1928-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_x_date(breaks = seq(1930, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-100, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Corporate saving, government saving, personal saving

Annual

Code
T50100 %>% filter(FREQ == "A") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_A %>%
              mutate(table = "T10105")) %>%
  year_to_date %>%
  group_by(date) %>%
  mutate(value = DataValue/DataValue[LineNumber == 1 & table == "T10105"]) %>%
  filter(LineNumber %in% c(9, 4, 10) & table == "T50100") %>%
  ggplot(.) + theme_minimal() +
  geom_line(aes(x = date, y = value, color = LineDescription)) +
  theme(legend.title = element_blank(),
        legend.position = c(0.5, 0.15)) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1928-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_x_date(breaks = seq(1930, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  ylab("% of GDP") + xlab("") +
  
  scale_y_continuous(breaks = 0.01*seq(-100, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Quarterly

Code
T50100 %>% filter(FREQ == "Q") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_Q %>%
              mutate(table = "T10105")) %>%
  quarter_to_date %>%
  group_by(date) %>%
  mutate(value = DataValue/DataValue[LineNumber == 1 & table == "T10105"]) %>%
  filter(LineNumber %in% c(9, 4, 10) & table == "T50100") %>%
  ggplot(.) + theme_minimal() +
  geom_line(aes(x = date, y = value, color = LineDescription)) +
  theme(legend.title = element_blank(),
        legend.position = c(0.2, 0.15)) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1947-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_x_date(breaks = seq(1930, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  ylab("Net Saving (% of GDP)") + xlab("") +
  
  scale_y_continuous(breaks = 0.01*seq(-100, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Undistributed profits, government saving, personal saving

Annual

Code
T50100 %>% filter(FREQ == "A") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_A %>%
              mutate(table = "T10105")) %>%
  year_to_date %>%
  group_by(date) %>%
  mutate(value = DataValue/DataValue[LineNumber == 1 & table == "T10105"]) %>%
  filter(LineNumber %in% c(9, 5, 10) & table == "T50100") %>%
  ggplot(.) + theme_minimal() +
  geom_line(aes(x = date, y = value, color = LineDescription)) +
  theme(legend.title = element_blank(),
        legend.position = c(0.5, 0.15)) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1928-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_x_date(breaks = seq(1930, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  ylab("% of GDP") + xlab("") +
  
  scale_y_continuous(breaks = 0.01*seq(-100, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Quarterly

Code
T50100 %>% filter(FREQ == "Q") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_Q %>%
              mutate(table = "T10105")) %>%
  quarter_to_date %>%
  group_by(date) %>%
  mutate(value = DataValue/DataValue[LineNumber == 1 & table == "T10105"]) %>%
  filter(LineNumber %in% c(9, 5, 10) & table == "T50100") %>%
  ggplot(.) + theme_minimal() +
  geom_line(aes(x = date, y = value, color = LineDescription)) +
  theme(legend.title = element_blank(),
        legend.position = c(0.5, 0.15)) +
  geom_rect(data = nber_recessions %>%
              filter(Peak > as.Date("1947-01-01")), 
            aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf), 
            fill = 'grey', alpha = 0.5) + 
  scale_x_date(breaks = seq(1930, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  ylab("% of GDP") + xlab("") +
  
  scale_y_continuous(breaks = 0.01*seq(-100, 100, 2),
                     labels = scales::percent_format(accuracy = 1))

Main Items - 1938, 1958, 1978, 1998, 2018

Percent of GDP

Code
T50100 %>% filter(FREQ == "A") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_A %>%
              mutate(table = "T10105")) %>%
  year_to_date %>%
  group_by(date) %>%
  mutate(year = year(date)) %>%
  filter(year %in% c(1938, 1958, 1978, 1998, 2008, 2018)) %>%
  group_by(year) %>%
  mutate(value = round(100*DataValue/DataValue[LineNumber == 1 & table == "T10105"], 1)) %>%
  filter(table == "T50100") %>%
  ungroup %>%
  select(2, 3, 7, 8) %>%
  spread(year, value) %>%
  slice(c(1, 2, 13, 21, 28, 35, 42)) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

1938, 1958, 1978, 1998, 2018 Full Table

Percent of GDP

Code
T50100 %>% filter(FREQ == "A") %>% select(-FREQ) %>%
  mutate(table = "T50100") %>%
  bind_rows(T10105_A %>%
              mutate(table = "T10105")) %>%
  year_to_date %>%
  group_by(date) %>%
  mutate(year = year(date)) %>%
  filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
  group_by(year) %>%
  mutate(value = round(100*DataValue/DataValue[LineNumber == 1 & table == "T10105"], 1)) %>%
  filter(table == "T50100") %>%
  ungroup %>%
  select(2, 3, 7, 8) %>%
  spread(year, value) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Billions

Code
T50100 %>% filter(FREQ == "A") %>% select(-FREQ) %>%
  year_to_date %>%
  mutate(year = year(date)) %>%
  filter(year %in% c(1938, 1958, 1978, 1998, 2018)) %>%
  group_by(year) %>%
  mutate(value = round(DataValue/1000)) %>%
  ungroup %>%
  select(2, 3, 6, 7) %>%
  spread(year, value) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}