Python statsforecast season_length vs freq

662 Views Asked by At

When setting up statsforecast models (for example AutoARIMA), one parameter is season_length for each model, and then for the statsforecast object, there is the freq parameter.

My assumption is that if I have weekly data, but I think that seasonality is monthly, I set freq to weekly and season_length to 4, or is this so that if I set freq to monthly, and then I'd set season_length to 4 as there are 4 samples in a season.

So how do these relate?

1

There are 1 best solutions below

0
On

The freq parameter refers to the datestamps in your data. For example, if you have monthly data, freq should equal 'M'. Behind the scenes, statsforecast uses this parameter to create future dates of the output dataframe. This parameter supports the offset aliases supported by pandas.

On the other hand, the season_length parameter of the models refers to the number of samples in a season. In the case of monthly data, it should equal 12.

If you have weekly data, you could use freq='W' and season_length=4 (if you are considering monthly seasonality).