1

X<- c(3,6,8,10,6,5) If I want to forecast using 3point moving average I use ma(X,3) from forecast package So this is going to give a series of smoothed average. If I want to forecast further 2 points ahead I used forecast (ma(X,3),h=2) So this forecast function doesn't use moving average method to forecast further points Rather it automatically chooses the eye model and forecasts the 2 points further. So my confusion is how do I forecast using 3 point moving average method only, as the forecast function uses ets?

Richard Hardy
  • 54,375
  • 10
  • 95
  • 219
Manisha
  • 80
  • 4

2 Answers2

0

I took your "toy example" of 6 values ...enter image description here and executed AUTOBOX ( a forecasting package that I have helped to develop ) and instructed the software to lock in a 3 period weighted average WITH equal coefficients and obtained

enter image description here and enter image description here

Following is the Actual/Fit and Forecast for 6 periodsenter image description here

Here are the 6 period out forecasts ....enter image description here using monte-carlo bootstrapping rather than presumptive normality for the residuals.

IrishStat
  • 27,906
  • 5
  • 29
  • 55
  • Thanks so much. – Manisha Dec 22 '19 at 02:35
  • Please accept my answer to close the question – IrishStat Dec 22 '19 at 14:19
  • The question asked about moving average smoothing, not the moving average model. Your answer misses the point, or at least does not state explicitly that what you show refers to using a different method than mentioned by OP. – Tim Dec 30 '21 at 23:24
  • If you us a two period moving average , you are essentially converting an observed series of N observations to a new series that contains N-1 "observations" or values. If you use a 3 period centered filter then you lose 2 values , one at each end. Assumed conversion strategies inject autocorrelation which are then empirically identifiable via the acf/pacf. – IrishStat Jan 04 '22 at 14:16
0

Moving average does not have the "forecast" functionality, because this is a method for smoothing the time-series, not forecasting. If you wanted to use it for forecasting, the only way that would make sense would be to use as a forecast the mean of the last three points and repeat the value as many times as you want for the forecast window. Beyond the last three points, you have nothing to smooth, and all the following values would average over the same points so they won't change. This is called the "naive". Repeating the last value is called the naïve (or random walk) forecasting method.

Given how small your dataset is, you are rather limited to simple forecasting methods. Using something like the naïve forecast, predicting the mean of the whole dataset, or mean of the last three values is probably not that a bad idea if you have good reason to believe that more recent values tell you more about the future than the rest of the time-series. The mean of the whole dataset (6.33) or of the last three values (7.0) and intervals from such forecasts would be strongly overlapping given the size of the data. If you looked at the 80% prediction interval for the mean forecast, you would be forecasting that the future would be not smaller than the smallest value in the data and not larger than the largest value (2.47-10.19).

Notice that the moving average is not the same as moving average model (see ), which can be used for forecasting.

Tim
  • 108,699
  • 20
  • 212
  • 390