# Generate prediction intervals for a simple moving average model

I'm using a simple moving average to generate a forecast. Say I have $$t$$ observations. Then the forecast for time $$t+1$$ is given by

$$$$\hat{Y}_{t+1}= \frac{Y_t+Y_{t-1}+\dots Y_{t-m+1}}{m}$$$$

If the forecasting horizon is longer than one period, then the forecasts are given by $$\hat{Y}_{t+h} = \hat{Y}_{t+1}$$. This obviously means that the forecasts are flat.

How can I generate a prediction interval for these forecasts? (say 95%). I've seen that Hyndman et al. (2021) give a formula for some simple methods, and I've been wondering if there is something like that for the simple moving average.

• Hi: In order to consruct a prediction interval, you need either A) an estimate of the variance and the mean of Y_t or B) a time series model for the $Y_t$ process from which you can obtain the mean and the variance. Sep 7, 2022 at 5:01
• Hyndman et al (2021) actually gives the h-step forecast standard deviation for other methods. So let's say I estimate the variance and the mean of $Y_t$ (using the data that I have, of course). Then how can I use this to construct the prediction intervals? Sep 7, 2022 at 5:07
• Hi: Obtaining $\hat{\mu}$ and $\hat{\sigma}$ depends on the underlying model for the process. Do you have some assumption about $Y_t$ in terms of its mean and variance ? Sep 8, 2022 at 16:59
• No, I don't, but I think I came up with a solution thanks to your previous comment. Sep 9, 2022 at 1:00

Inspired by one of the comments made by @mlofton, I used the following solution. It might not be the best, but for now it works for my particular problem (generating prediction intervals for a window average)

Consider a moving average model of order $$q$$, denoted MA(q). Then

$$X_t = \mu + \epsilon_t +\theta_1 \epsilon_{t-1} + \dots + \theta_q \epsilon_{t-q}$$

If we pick $$q=0$$, then

$$X_t = \mu + \epsilon_t$$

Hence the value for $$X_t$$ is simply the mean plus an error.

So let's consider an ARIMA(p,q,d) model. Using $$p=q=d=0$$, the ARIMA model is equal to the historic average. The prediction intervals for this particular ARIMA model can be easily computed using the forecast R package. The key here is only using the data in the window that we're considering. The point forecast of the ARIMA model will be equal to the point forecast of the Window Average. And we can use the prediction intervals of that ARIMA model as prediction intervals of the Window Average.

• yes, that's a white noise process with a non zero mean. The model for the windowed average process would imply that the mean is still $\mu$ and the variance is the sum of the variance of the terms in the moving average so it would be $\frac{n \times \sigma^2} {n^2} = \frac{\sigma^2}{n}$ where $n$ is the window size. You can use those for the prediction interval but you may need to predict the next value of $X_{t}$ ( I'm not clear on if you are using all past values for the prediction or leaving one out and predicting the next one ) so you may have to add a $\sigma^2$ term to the variance. Sep 10, 2022 at 3:14