I am trying to apply regression to a problem where I have a time series that I want to predict - say y. Y is seasonal and let's say has 3 seasons summer, winter and other.

I have 3 predictors X1, X2 and X3. Y has a linear relationship with X1 during Summers but not during the other seasons. Similarly it is linearly related to X2 in winters and X3 in other months. ie Y(summer) ~ X1. Y(winter) ~ X2. Y(other) ~ X3

My current approach is to run 3 separate regressions after splitting the dataset into 3 parts (summer, winter and shoulder) We get the final time series predictions by combining predictions from each season. In the current approach the final residuals seem to be expressing some trend and are autocorrelated. So we are thinking of modelling the residuals separately

Is this a correct approach to such a problem or is there a better time series way to approach this? Any pointers to books/articles that solve similar problems will be really helpful

  • $\begingroup$ This sounds to me like your indicators of season are perfectly separate wrt your three predictors. In that case you can just use a factor indicator of season as your predictor variable and begin building the model from there. $\endgroup$ Apr 11 at 0:52

1 Answer 1


I would probably do GAMs or trees for something like this and see what happens. For a tree (if there is a significant trend) you could detrend then fit your y with fourier basis functions for general seasonality, piecewise linear basis functions, lagged y values, and the season dummy you describe. Should be able to pick up on very complex relationships depending on the tree model you use.

I'll plug a dev project I whipped up that does a lot of this for you LazyProphet.

And here is an example gist of a multivariate problem.

So in your case I would just let linear_trend='auto' unless your time series has a significant and visibly obvious trend. And just create your seasonal dummies to pass as X_train and X_test.

Mess around with some of the other parameters. Could be good, could be bad.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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