Skip to contents

Subtracts the mean from the observed residuals before forming the bootstrap, thereby enforcing zero-mean samples in expectation.

Usage

draw_bootstrap_zero_mean(n, errors, ...)

Arguments

n

The number of innovations to draw

errors

The residual errors that are used to define the distribution from which the innovations are drawn

...

Additional arguments passed from predict.threedx(), ignored

Value

A vector of same type as errors and of length n

Examples

model <- learn_weights(
  y = rpois(n = 55, lambda = pmax(0.1, 1 + 10 * sinpi(1:55 / 6))),
  period_length = 12L,
  alphas_grid = list_sampled_alphas(n_target = 25),
  loss_function = loss_mae
)

forecast <- predict(
  object = model,
  horizon = 12L,
  n_samples = 1000L,
  observation_driven = FALSE,
  innovation_function = draw_bootstrap_zero_mean
)