Skip to content
Predict.ai

Data & drivers

Rolling window

A rolling window is a moving slice of the last n points used to compute a statistic — mean, max, standard deviation. It summarizes recent level without keeping every lag as its own column.

A 7-day rolling mean is a smoother yesterday. A 28-day rolling standard deviation is a cheap volatility feature. Both must be computed using only data available at the forecast origin.

If your window includes today while predicting today, you leaked. If it includes the future week because someone grouped by calendar month too early, you leaked with extra steps.

Windows have a personality. Short windows chase noise. Long windows miss breaks. Many teams keep one short and one long and let the model pick.

Formula

rollmean_n(y)_t = (y_{t-1} + … + y_{t-n}) / n

Read next

Related terms

Try it on your data.

Connect an outcome and its history. Predict.ai finds the drivers, races the models, and keeps the forecast live — in the workspace, over the API, and through agents.