Displaying 1 result from an estimated 1 matches for "seasonalchoice".
2025 Jan 03
0
stats/HoltWinters.R inverted logic in seasonal in R and C
...e6f34b0831efb1ae/src/library/stats/R/HoltWinters.R#L98
The C code interprets a seasonal value of 1 as additive and 0 as
multiplicative.
The R seasonal can be "additive" or "multiplicative", so the R code must
invert the logic when calling C.
The proposed solution is to define a seasonalChoice variable:
hw <- function(x, alpha, beta, gamma, seasonal, start.time, f, ...) {
lenx <- length(x)
seasonalChoice <- if (seasonal == "multiplicative") 0L else 1L
.C(C_HoltWinters,
as.double(x),
lenx,
as.double(max(min(alpha, 1), 0)),
a...