Displaying 1 result from an estimated 1 matches for "c_holtwint".
2025 Jan 03
0
stats/HoltWinters.R inverted logic in seasonal in R and C
...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)),
as.double(max(min(beta, 1), 0)),
as.double(max(min(gamma, 1), 0)),
as.integer(start.time),
as.integer(seasonalChoice),
as.integer(f),
as.integer(!is.logical(beta) || bet...