Creates an AutoRegressive Moving Average model. The series is modelled around a deterministic mean $$\mu_t = \theta_1 + \sum_{j=1}^k [\theta_{2j} \sin(2\pi j t / s) + \theta_{2j+1} \cos(2\pi j t / s)] + \theta_{2k+2} t$$ where the harmonic terms are present when `s > 0` and the linear term when `include_drift = TRUE`. An intercept is always estimated. Without seasonality `k` counts as 0, so the drift is \(\theta_2\).

ARMAModel(p = 0L, q = 0L, s = 0L, k = 1L, include_drift = FALSE)

Arguments

p

AR order (default: 0)

q

MA order (default: 0)

s

Seasonal period (default: 0 for no seasonality)

k

Number of harmonic waves used to represent seasonality (default: 1). Higher values allow sharper, asymmetric seasonal shapes. Only meaningful when `s > 0`. The mean parameters are estimated by a derivative-free search started from zero, which can settle on a solution far from the data. The risk grows with the number of waves and with the distance of the series from zero: at a mean of 100 two waves fail, while on low-count series they usually, though not always, succeed. Compare the fitted mean with the data before trusting a seasonal fit. Reported upstream at <https://github.com/ManuelStapper/ForecastBaselines.jl/issues/4>.

include_drift

Whether to include a linear trend in the mean (default: FALSE)

Value

A spec for a Julia `ARMAModel`, built when it is fitted (see [juliabridge::julia_spec()])

Examples

if (FALSE) { # \dontrun{
# AR(1)
model <- ARMAModel(p = 1)

# MA(1)
model <- ARMAModel(q = 1)

# ARMA(2,1) with seasonality
model <- ARMAModel(p = 2, q = 1, s = 12)

# Annual seasonality with a linear trend
model <- ARMAModel(p = 1, s = 52, include_drift = TRUE)
} # }