Using Australian Bureau of Statistics indices, provides functions that convert historical, nominal statistics to real, contemporary values without worrying about date input quality, performance, or the ABS catalogue.
Utility package for CPI and other inflators.
awe_inflator() uses all employees' average weekly total earnings;
awote_inflator() uses full-time adults' average weekly ordinary time earnings.
Both cover persons, Australia. Original, seasonally adjusted and trend data are
available through awe_original(), awe_seasonal(), awe_trend() and the
corresponding awote_*() functions.
awe <- awe_original() # date and value (dollars per week)
awote_inflator("2024-05-15", "2025-05-15")
awe_inflator("2024-05-15", "2025-05-15", series = awe_seasonal())
awote_inflator("2030-05-15", "2031-05-15", series = awote_original("3%"))
The ABS May 2026 release
is bundled for offline use; download_data() refreshes it through the package's
ABS mirror. Original series begin in November 1994; adjusted and trend series
begin in May 2012. Inflators use May observations for May to October and November
observations for November to April, with the usual endpoint checks. Earnings
changes include workforce composition effects; wage_inflator() uses the WPI.
x <- rep_len(fy::yr2fy(1999:2020), 1e7)
system_time(grattan::cpi_inflator(, x, "2019-20"))
## process real
## 531ms 482ms
system_time(cpi_inflator(x, "2019-20"))
## process real
## 438ms 439ms
system_time(cpi_inflator(x, "2019-20", nThread = 4L))
## process real
## 391ms 114ms
y <- dqrng::dqsample(x)
system_time(grattan::cpi_inflator(, x, y))
## process real
## 24.3s 21.1s
system_time(cpi_inflator(x, y, nThread = 4L))
## process real
## 984ms 241ms
x <- rep_len(x, 1e8)
system_time(cpi_inflator(x, "2019-20", nThread = 4L))
## process real
## 4.61s 1.25s
x <- y <- NULL
x <- seq(as.Date("1999-01-01"), as.Date("2020-01-01"), by = "1 day")
x <- rep_len(x, 1e7)
system_time(cpi_inflator(x, "2019-01-01"))
## process real
## 297ms 311ms
x <- rep_len(x, 1e8)
system_time(cpi_inflator(x, "2019-01-01", nThread = 4L))
## process real
## 3.67s 1.29s
x <- as.IDate(x)
system_time(cpi_inflator(x, as.IDate("2019-01-01"), nThread = 4L))
## process real
## 2.66s 905.37ms