Skip to content

Instantly share code, notes, and snippets.

@MattCowgill
Created February 19, 2024 02:41
Show Gist options
  • Save MattCowgill/19718c045704b58608af9aa6440da389 to your computer and use it in GitHub Desktop.
Save MattCowgill/19718c045704b58608af9aa6440da389 to your computer and use it in GitHub Desktop.
library(auseconhist) # remotes::install_github("MattCowgill/auseconhist")
library(readabs)
library(tidyverse)
library(slider)
butlin <- auseconhist::butlin_t7 |>
filter(!is.na(awe),
year >= 1901) |>
select(date = year, value = awe, cpi) |>
mutate(series = "awe",
source = "Butlin, Dixon & Lloyd (2014)",
date = ymd(paste(date, "06", "01", sep = "-")))
awe <- read_awe("awe")
awote <- read_awe("awote")
cpi <- read_cpi()
abs <- awe |>
bind_rows(awote) |>
group_by(series = wage_measure) |>
padr::pad("day") |>
fill(value) |>
select(date, value, series) |>
mutate(source = "ABS") |>
left_join(cpi,
by = "date") |>
filter(!is.na(cpi))
rw <- butlin |>
bind_rows(abs) |>
group_by(series, source) |>
mutate(real_awe = (value / cpi) * cpi[date == ymd("2010-06-01")]) |>
mutate(real_awe_10yago = slide_index_dbl(.x = real_awe,
.i = date,
.f = \(x) x[1],
.before = years(10),
.complete = TRUE)) |>
mutate(real_awe_growth = (real_awe / real_awe_10yago) - 1)
rw |>
filter(series == "awe") |>
ggplot(aes(x = date, y = real_awe_growth, col = source)) +
geom_hline(yintercept = 0) +
geom_line() +
scale_y_continuous(labels = scales::percent,
limits = c(-0.2, 0.6)) +
scale_x_date(breaks = seq(max(rw$date),
min(rw$date),
by = "-20 years"),
date_labels = "%Y") +
theme_minimal(base_family = "Roboto Condensed") +
theme(axis.title.x = element_blank(),
axis.title.y = element_blank(),
legend.position = c(0.5, 0.95),
legend.direction = "horizontal",
panel.grid.minor = element_blank(),
plot.caption.position = "plot",
plot.title.position = "plot",
plot.caption = element_text(hjust = 0)) +
labs(colour = "Source: ",
title = "There have been three 10-year periods in which Australian real wages growth was negative",
subtitle = "Real wages growth over rolling 10 year windows, 1911-2023",
caption = "Sources: Butlin, Dixon & Lloyd (2014) for pre-1983 AWE and CPI data; ABS AWE (various years); ABS CPI; author's calculations.")
ggsave("real_awe_decades.png",
width = 20,
height = 13,
units = "cm",
dpi = 300,
bg = "white")
@MattCowgill
Copy link
Author

real_awe_decades

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment