Learn R Programming

grattanInflators (version 0.5.4)

cpi_inflator: CPI inflator

Description

CPI inflator

Usage

cpi_inflator(
  from = NULL,
  to = NULL,
  series = c("seasonal", "original", "trimmed.mean", "monthly-original",
    "monthly-seasonal", "monthly-excl-volatile"),
  fy_month = 3L,
  x = NULL,
  check = 1L,
  nThread = getOption("grattanInflators.nThread", 1L)
)

cpi_seasonal(..., FORECAST = FALSE, LEVEL = "mean")

cpi_original(..., FORECAST = FALSE, LEVEL = "mean")

cpi_trimmed_mean(..., FORECAST = FALSE, LEVEL = "mean")

cpi_monthly_original(..., FORECAST = FALSE, LEVEL = "mean")

cpi_monthly_seasonal(..., FORECAST = FALSE, LEVEL = "mean")

cpi_monthly_excl_volatile(..., FORECAST = FALSE, LEVEL = "mean")

Value

If `x` is `NULL`, the default, a numeric vector matching the lengths of `from` and `to` equal to the inflators by which nominal prices dated `from` must be multiplied so that they are in `to` real terms.

If `x` is numeric, it is taken to be prices dated `from` and the value returned is `x` in `to` real terms.

Arguments

from, to

Times for which the inflator is desired. If NULL, a date range close to the previous year is used.

series

Which CPI series to use.

fy_month

An integer 1-12, the month to be used for years and financial years in from or to. Since the CPI is a quarterly series, specifying a year is ambiguous. For financial years, the month is the month of the financial year, so for example fy_month = 9 and "2015-16" means Sep-2015, while fy_month = 6 means Jun-2016.

x

(Advanced) A vector that will be inflated in-place. If NULL, the default, the return vector is simply the inflation factor for `from`.

check

integer(1) If 0L, no checks are performed, and clearly invalid inputs result in NA in the output. If check = 1L an error is performed for bad input; check = 2L is more thorough.

nThread

Number of threads to use.

...

Set of date-rate pairs for custom CPI series in the future.

FORECAST

Whether the series should be extended via an ETS forecast.

LEVEL

If `FORECAST = TRUE` what prediction interval should be used. (`LEVEL = 20` means the lower end of an 80% prediction interval.) If `LEVEL = "mean"` (the default), the central estimate is used.

Examples

Run this code
cpi_inflator(1995, 2019)  # Inflation from 1995 to 2019
cpi_inflator("2015-16", "2016-17")
cpi_inflator("2015-01-01", "2016-01-01")

if (Sys.Date() < as.Date("2029-01-01")) {
  cpi_inflator("2030-01-01", "2031-01-01",
               series = cpi_original(2030, 0.1))
  cpi_inflator("2030-01-01", "2031-01-01",
               series = cpi_original(0.1))
  cpi_inflator("2030-01-01", "2032-01-01",
               series = cpi_original(2030, 0.1, 2031, 0.1, 2032, 0))
}


Run the code above in your browser using DataLab