1
$\begingroup$

I was reading about different variants of backtesting in time series- expanding window & rolling window. I could find in texts about when to use which, but still I'm sort of unanswered.

Here's what I've read- Expanding (recursive) window is useful when the series has a strong seasonal pattern and stable trend as in this case the first observations of the series contain potential information the future values. While rolling window is useful when we have a rather volatile series or when the most recent history is more relevant for forecasting (high correlation with most recent lags).

While this is fine, I'm still not able to clearly understand why the following is suggested as decision criteria. What exactly is the need to define two different structures of windows? What if we use expanding window to estimate the forecasting error for a volatile series?

Because, as far as I know, we anyway train our final model on the whole data that's available. Then what's the point using a rolling window because of the reasoning that's given.

$\endgroup$

1 Answer 1

0
$\begingroup$

In time series forecasting, we want to predict future values of the time series. And to do so, we normally have only its past values.

To forecast using traditional machine learning models, like for example, a linear regression, we need to create input features that we can use to train those models.

To create suitable input features, we use past values of the time series.

We can create for example "lag features", which consist of simply using past values of the time series to predict future values.

We can also create window features, which consist in applying aggregation operations, like the mean, max, std, etc, to windows of past data.

We can use rolling windows, which have constant size, or expanding windows.

I would use a rolling window when the data points closer to the point of forecast are more relevant to the forecast.

If the data is too volatile, we could use larger rolling windows or expanding windows instead.

Whether to use one or the other depends on the nature of the time series: seasonality, trend, also granularity and size.

One approach would be to craft the features after data analysis. A second approach would be to just create lots of features, with various rolling windows and expanding windows, and then use feature selection to find the most suitable.

Feature-engine has started to offer support for the automatic creation of rolling and expanding windows

There are also some examples in this repo.

$\endgroup$

Your Answer

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

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