5
$\begingroup$

Just want to preface that I'm relatively new to working with time series forecasts.

I'm pulling together a forecast I just want to understand a bit about the difference between an STL forecast and a TSLM forecast. I know that TSLM allows you to put in an external regressor, but I have only included the trend and seasonal in my model. Just want to know why the two forecasts look different/have such different prediction intervals.

library(forecast)
library(tidyverse)

autoplot(forecast(stl(time_series, s.window="periodic", robust=TRUE), h=123, method="ets")) +theme(legend.position="none")

STL a_tslm <- tslm(time_series ~ trend + season)

autoplot(forecast(a_tslm, h=123)) +theme(legend.position="none")

TSLM

$\endgroup$
2
$\begingroup$

I think I got my answer.

A TSLM is literally just that. Essentially a data frame is created with 3+ columns. Column 1 is your y value. Column 2 is the numbers 1 to however_many_observations_you_have. Column 3 is a factor variable that corresponds to your seasonal. In my case, 1 to 12. Then it just compiles a regression based off of that.

STL on the other hand will find the trend (using loess). Then break out the seasonal.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.