-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmin_wage_productivity.qmd
82 lines (71 loc) · 1.8 KB
/
min_wage_productivity.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: "Minimum wage productivity"
format: html
theme: cosmo
date: "`r Sys.Date()`"
date-format: long
execute:
echo: false
---
\captionsetup[table]{labelformat=empty}
\vspace{-3em}
```{r}
#| output: false
library(tidyverse)
library(scales)
library(gt)
library(kableExtra)
library(hrbrthemes)
library(bea.R)
bea_key <- Sys.getenv("BEA_API_KEY")
bea_grab <- function(tablename) {
bea_specs <- list(
'UserID' = bea_key,
'Method' = 'GetData',
'datasetname' = 'NIPA',
'TableName' = tablename,
'Frequency' = 'A',
'Year' = 'X'
)
beaGet(bea_specs, asWide = FALSE) %>%
as_tibble()
}
bea_ndp <- bea_grab("T10705") %>%
filter(LineNumber == 14) %>%
transmute(year = as.numeric(TimePeriod), ndp = DataValue)
bls_hours <- read_csv("inputs_raw/total-economy-hours-employment.csv") %>%
filter(
Component == "Total U.S. economy",
Basis == "All workers",
Measure == "Hours worked"
) %>%
select(year = Year, hours = Value) %>%
filter(year >= 1948, year <= 2022) %>%
mutate(hours = as.numeric(hours)) %>%
summarize(hours = mean(hours), .by = year)
productivity <- bea_ndp %>%
full_join(bls_hours, by = "year") %>%
mutate(prod = ndp / hours)
```
```{r}
prod_base <- productivity %>%
filter(year == 1967) %>%
pull(prod)
mw_data <- productivity %>%
add_row(year = 2023) %>%
mutate(prod_mw = case_when(
year == 1968 ~ 1.60,
year >= 1969 ~ 1.60 * lag(prod) / prod_base
)) %>%
filter(!is.na(prod_mw))
mw_data %>%
ggplot(aes(x = year, y = prod_mw)) +
geom_line() +
scale_y_continuous(labels = label_dollar(), breaks = seq(0,24,2)) +
hrbrthemes::theme_ipsum() +
labs(x = NULL, y = NULL)
mw_data %>%
mutate(prod_mw = scales::label_dollar()(prod_mw)) %>%
select(Year = year, 'Productivity-indexed minimum' = prod_mw) %>%
gt()
```