This function allows to conformalize any forecasting function.

conformalize(
  FUN,
  y,
  h,
  level = 95,
  method = c("block-bootstrap", "surrogate", "kde", "bootstrap"),
  nsim = 100L,
  block_size = 5,
  seed = 123L,
  ...
)

Arguments

FUN

A forecasting function.

y

A time series (ts object or vector).

h

Forecasting horizon.

level

Confidence level.

method

Method to be used for conformalization (simulation of calibrated residuals).

nsim

Number of simulations.

block_size

Block size for block-bootstrap.

seed

Seed for reproducibility.

...

Additional arguments to be passed to the forecasting function.

Value

An object of class forecast.

Examples


y <- fdeaths
h <- 25L
obj <- conformalize(FUN=forecast::ets, y, h); plot(obj)

obj <- conformalize(FUN=HoltWinters, y=y, h=h, seasonal = "mult"); plot(obj)