Hello everyone,

I have a question regarding Rolling Forecasting. I am currently working with the following loop. This loop gives a multi-step forecast with a re-estimation for 1-steps ahead. For each new value a new Single Exponential Smoothing model is calculated, right? But I would like to have a model where at the beginning a SES model is calculated for an alpha over the training set and this alpha is applied as rolling forecast to the values of the training set. With the Arima model (also enclosed) I manage to use the same ARIMA model. To sum it up I am looking for a loop not using re-estimation for the SES Model but for the values. Please help me to solve the problem for SES and similarly for holt() and stlf().

Best regards

Luke

#Timeseries

ts <- ts(data03$demand, ###CHANGE DATA

start = c(2016,1),

frequency = 52)

train <- window(ts,

start = c(2016, 1),

end = c(2018, 52))

test <- window(ts,

start = c(2019, 1),

end = c(2019, 52))

# SES with reestimation

h <- 1

n <- length(test) - h + 1

ses_mat <- matrix(0, nrow=n, ncol=h)

for(i in 1:n)

{

x <- window(ts, end=c(2018, 52) + (i-1)/52)

refit <- ses(x, fan=FALSE, initial = c("optimal"),

alpha = NULL, lambda = NULL, biasadj = FALSE)

ses_mat[i,] <- forecast(refit, h=h)$mean

}

ses_mat2 <- ts(ses_mat, start=c(2019,1), end=c(2019,52), frequency=52)

accuracy(ses_mat2, test)

ses_mat2 %>% autopilot()

#for comparison my ARIMA Model without reestimation

fit <- auto.arima(train)

order <- arimaorder(fit)

fcmat <- matrix(0, nrow=n, ncol=h)

for(i in 1:n)

{

x <- window(ts, end=c(2018, 52) + (i-1)/52)

refit <- Arima(x, order=order[1:3], seasonal=order[4:6])

fcmat[i,] <- forecast(refit, h=h)$mean

}