I have a daily time series with multiplicative seasonalities : yearly, monthly and weekly seasonalities.

I want to try a GAM model to forecast the time series

I don’t know how the trend should be accounted for.

  • I plan to use natural cubic splines with continuous time as a feature to model the trend. During inference, I have to extrapolate and I think that it is better to use natural splines for this.

  • I plan to use cyclic cubic splines to model the seasonalities. The features will be day-of-week, day-of-month, day-of-year

  • I have categorical features (0/1) for special events like holidays (and days before/after), back to school, scholar holidays.

As I am new to GAMs, how would you handle such a forecasting problem ? Also, how can I take into account the multiplicative aspect of seasonalities ? Shall I use a log link function ?


1 Answer 1


When using Generalized Additive Models (GAMs) for forecasting, a common concern arises regarding the prediction of values outside the range of the training data. This issue stems from the behavior of smooth functions employed in GAMs, where the second derivatives at the boundaries are often zero. Consequently, these functions tend to linearly extrapolate beyond the last observation, potentially leading to unrealistic forecasts.

To mitigate this problem, there are a few technical solutions available. One approach is to extend the evaluation of the penalty into the range of values that you want to forecast, such as weeks or years ahead of the training data. By doing so, the model's uncertainty can grow in a more realistic manner when predicting out-of-sample. Another solution involves imposing a first derivative penalty, which enforces the function to utilize the last observed value for forecasting while maintaining fixed uncertainty.

These technical measures help address the issue of unrealistic extrapolation in GAMs for forecasting. It's important to consider these solutions to ensure more reliable and accurate predictions, particularly when dealing with cases where the estimated function exhibits significant changes in the response-predictor relationship near the boundary.

Also maybe check D-GAMS from the R package mvgam


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.