Statistics & probability

Trailing moving average forecast calculator

Create rolling one-step forecasts without including the period being predicted.

Your numbers

1–1,000 finite values within ±1 trillion, separated by commas, spaces or semicolons. Nonzero magnitudes must be at least 10⁻¹². Keep paired lists in corresponding row order; no missing-value markers.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your numbers and select Calculate.

Try it, understand it

Explore the result

Vary the trailing window while keeping the series fixed.

Worked example comparison
ExampleOutputWhat to notice
A three-period windowNext-period trailing-average forecast30The next forecast for 10,20,30,40 is 30; only period four has a scored forecast.
The last-value baselineNext-period trailing-average forecast40Window one gives next forecast 40 and three scored one-step forecasts.
Use all four observationsNext-period trailing-average forecast25The next forecast is 25 and no observed later period is available for scoring.

Check your understanding

Can the forecast for period four use its own actual?

No. That would include information unavailable when the forecast was made.

Is a smaller reported MAE always a fair model comparison?

Compare the same held-out periods; different windows can score different rows.

Behind the numbers

How this calculation works

Average the latest complete window of k observations. Slide the window one period at a time and compare each forecast with the next actual when available. The final window produces the next unknown period forecast.

THE FORMULAForecast for t+1 = mean of yₜ₋ₖ₊₁ through yₜ

A worked example

With observations 10,20,30,40 and a three-period window, the forecast for period four was 20 while its actual was 40. The next-period forecast is (20+30+40)/3 = 30.

Good to know

Chronological, equally spaced unweighted data. A window of one is the last-value forecast. No calendar parsing, centered smoothing, automatic seasonality, trend extrapolation or prediction interval. Final future forecast is not scored.

The forecast must precede the observation it predicts

For the series 10,20,30,40 and window three, the first available forecast is for period four. Only periods one through three were known at that point, so that forecast is 20. The actual fourth observation is 40 and the absolute forecast error is 20.

After observing period four, discard 10 and average 20,30,40. The resulting 30 predicts period five, whose actual has not been entered. It is reported as a future forecast and excluded from the historical error score. This separation avoids scoring a number against information that was used to calculate it.

The forecast error calculator compares aligned predictions with actuals using several error definitions. This page supplies only one-step MAE for its own available predictions.

A wider window trades responsiveness for smoothing

A one-period window repeats the latest observation and acts as a last-value baseline. Increasing the window mixes more older observations into each mean. A sudden level change then influences the forecast gradually as earlier values leave the window.

For the same rising series, windows one, two and three produce next forecasts 40,35 and 30. This does not establish that the smallest window is always best. Compare forecasts on the same later observations, rather than treating scores from different numbers of scored periods as a controlled contest.

Row positions stand for equal time intervals

The calculation has no timestamp field. If monthly data skip a month, two neighboring entries are no longer one equal time interval apart. Decide how to handle missing periods before using the model; inserting zero would assert an actual zero observation, not represent an unknown value.

The simple exponential smoothing calculator gives older observations declining influence instead of dropping them at a hard window boundary. Use the forecast error calculator to compare aligned forecasts on a deliberately chosen holdout period. No averaging window here automatically corrects a trend or seasonal cycle.

A few questions, answered

Is this a centered moving average?

No. Every window is trailing and uses only periods before the forecast period.

What if the window equals my list length?

There is one next-period forecast and no observed later period to score, so MAE is undefined.

Are the output periods calendar dates?

No. They are one-based row positions in the entered equally spaced sequence.

Find your calculator

Start typing to explore the library.