R Time Series Linear Regression - Forecast Help

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

R Time Series Linear Regression - Forecast Help


i built a trend model for a time series , using trend, seasonal and a seasonal dummy for March, which starts a few years after the beginning of the ts.

the regression in R looks like this

fit = tslm(data ~ trend + season + Marchdummy, data=dummy)

I would then like to predict 3 years in advance using the forecast function and use the following dataframe for the newdata argument:

forecast <- data.frame(MarchDummy=rep(0,36))
forecast[3,] <- 1
forecast[15,] <- 1
forecast[27,] <- 1


I'm not sure if the dataframe forecast created for newdata is done correctly or not. I want to forecast using trend, season + DummyVariable.

Thank you