I wish to use Fourier terms as predictors in my XGBoost model.

My date is weekly sales from the timetk::walmart_sales_weekly dataset in R.

To use Fourier terms there are two arguments required in the timetk package, .periods and .K where .periods is the periods for the fourier series and .K is the maximum number of Fourier orders.

According to Rob Hyndman's Forecasting: Principals & Practice book The maximum allowed is K = m/2 where m is the seasonal period.

How does one know how many Fourier terms to use as regressors, is it a case of running an lm model and adding each new pair of terms and checking the R squared value for improvement?

  • $\begingroup$ I like model selection criteria over r-squared (which is hackable). AIC, or AICc come to mind. $\endgroup$ Oct 26, 2022 at 13:26


Your Answer

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

Browse other questions tagged or ask your own question.