Search code examples
rstltime-seriesforecastingforecast

error in refitting stlm model to the whole training set


I would like to use a previously fitted stlm model with "arima" method and a matrix of regressors on the whole training set, but I am encountering an error. Here a reproducible example:

library(forecast)
set.seed(12345)

xa <- sample(c(0,1),length(wineind),replace = T,prob = c(0.2,0.8))
xb <- sample(c(0,1),length(wineind),replace = T,prob = c(0.99,0.01))
t1 <- window(wineind, end = c(1989,12))
xa1 <- xa[1:length(t1)]
xb1 <- xb[1:length(t1)]

m1 <- stlm(t1,method = "arima",
           robust = T,
           xreg = cbind(xa1,xb1),
           lambda = "auto")

t2 <- window(wineind, end = c(1992,12))
xa2 <- xa[1:length(t2)]
xb2 <- xb[1:length(t2)]

m2 <- stlm(t2,model = m1,xreg = cbind(xa2,xb2))

The error is: "Error in arima2(x, model, xreg = xreg, method = method) : No regressors provided"

May anyone help me understand this?


Solution

  • It was a bug, immediately solved. Thanks Rob! Issue on github