Mirrors morie.fn.johw. Seasonal indices are initialised from
a CENTRED MOVING AVERAGE detrend, not from raw period means: with a
trend inside the period the per-position mean absorbs part of the
slope and the indices come out phase-shifted.
Usage
morie_holt_winters(
y,
alpha = NULL,
beta = NULL,
gamma = NULL,
m = 12L,
horizon = 1L,
seasonal = "additive"
)
Arguments
- y
numeric series, at least 2 * m observations.
- alpha, beta, gamma
smoothing parameters in (0, 1); estimated
when NULL.
- m
seasonal period.
- horizon
forecast horizon.
- seasonal
"additive" or "multiplicative"; the latter requires
strictly positive data.
Value
list: forecast, level, trend, season, fitted, residuals,
sse, alpha, beta, gamma, m, seasonal, n.
References
Hyndman, R. J. & Athanasopoulos, G. (2021).
Forecasting: Principles and Practice (3rd ed.). OTexts. Sec. 8.3
(Holt-Winters), Sec. 3.4 (classical decomposition).
Examples
set.seed(1)
y <- rep(c(3, 1, -2, -4, -1, 2, 5, 4, 1, -1, -3, -5), 4) + seq_len(48) * 0.5 + 10
morie_holt_winters(y, m = 12, horizon = 12)$forecast[1]
#> [1] 36.52045