Moving Average
Overview for Moving Average
Learn more about Minitab
Use Moving Average to smooth your data and to provide short-term forecasts when your data do not
have a trend. You can use moving average when your data have a seasonal pattern if you set the length
of the moving average to equal the length of the seasonal pattern.
For example, a human resources manager uses a moving average analysis to predict employment in the
food industry for the next 6 months.
Where to find this analysis
• Mac: Statistics > Time Series > Moving Average
• PC: STATISTICS > Forecast > Moving Average
When to use an alternate analysis
If your data have a trend and do not have a seasonal component, use Trend Analysis or Double
Exponential Smoothing.
Data considerations for Moving Average
Learn more about Minitab
To ensure that your results are valid, consider the following guidelines when you collect data, perform
the analysis, and interpret your results.
Record data in chronological order
Time series data are collected at regular intervals and are recorded in time order. You should record the
data in the worksheet in the same order that you collect it. If the data are not in chronological order, you
cannot assess time-related patterns in the data. However, you can still use Scatterplot to investigate the
relationship between a pair of continuous variables.
Collect enough data to assess trends or patterns
Collect enough data so that you can fully assess trends or patterns in the data. For example, you need
enough data to be sure that any pattern you observe is a long-term pattern and not just a short-term
anomaly.
Collect data at appropriate time intervals
Choose the time interval based on the patterns that you want to detect. For example, to look for month-
to-month patterns in a process, collect data at the same time each month. If you collect data each week,
then the monthly pattern may be lost in the noise of the weekly data. If you collect data each quarter,
the monthly pattern may be lost when it is averaged out in each quarter.
If you are looking only for general trends or shifts in the data over time, and not for patterns associated
with a specific time interval, the length of the interval is less important.
Your data should not have either a trend or seasonal component
You can use moving average with a seasonal pattern if you set the moving average length to the length
of the seasonal cycle. However, if your data a trend and do not have a seasonal component, you can
also use Trend Analysis or Double Exponential Smoothing.
Example of Moving Average
Learn more about Minitab
A toothpaste retailer collects sales data and the number of commercials that were broadcast during the
previous 60 weeks. The retailer creates a time-series model for prediction of sales.
1. Open the sample data, ToothpasteSales.MTW.
2. Open the Moving Average dialog box.
• Mac: Statistics > Time Series > Moving Average
• PC: STATISTICS > Forecast > Moving Average
3. In Y variable, enter Sales.
4. In MA length, enter 2.
5. On the Forecast tab, select Number of forecasts to generate and enter 6.
6. Click OK.
Interpret the results
On the moving average plot, the forecasts and line closely follow the data, especially at the end of the
series. The retailer can be 95% confident that the sales will be between approximately 53 and 67 for the
next 6 months.
Method
Moving average length 2 MAPE 8.88
Rows used 101 MAD 2.92
Accuracy Measures MSD 13.83
Forecasts
Period Forecast 95% Lower PI 95% Upper PI
102 60.00 52.71 67.29
103 60.00 52.71 67.29
104 60.00 52.71 67.29
105 60.00 52.71 67.29
106 60.00 52.71 67.29
107 60.00 52.71 67.29
Perform the analysis
Enter your data for Moving Average (Data tab)
Learn more about Minitab
On the Data tab of the Moving Average dialog box, specify the data for the analysis, specify the time
scale, enter the moving average length, and specify whether to center the moving averages.
In This Topic
• Enter your data
• Center the moving averages
Enter your data
Complete the following steps to specify the column of data that you want to analyze.
1. In Y variable, enter a column of numeric data that were collected at regular intervals and
recorded in time order. If your data are in multiple columns (for example, you have data for
each year in a separate column), you must stack the data into a single column.
2. (Optional) In Time scale labels, enter a column to label the x-axis with values, such as dates.
If you don't enter a column, Minitab labels each time period with an integer starting at 1.
3. In MA length, enter the number of consecutive observations that Minitab uses to calculate the
moving averages. For example, for monthly data, a value of 3 indicates that the moving average
for March is the average of the observations from March, February, and January. If there is a
seasonal pattern, you can set the length equal to the length of the seasonal pattern.
The moving average length adjusts the amount of smoothing. Typically, smooth the data enough to
reduce the noise (irregular fluctuations) so that the pattern is more apparent. However, don't smooth the
data so much that you lose important details. Lower values produce a less smooth line. Higher values
produce a smoother line. To calculate naive forecasts, use a moving average length of 1. For more
information on naive forecasting, go to Forecasting with time series analysis and click "What is naive
forecasting?".
Moving average = 2 Moving average = 6
In this worksheet, Sales contains the number of computers that are sold each month.
C1
Sales
195000
213330
208005
249000
237040
Center the moving averages
Select to plot each moving average value at the center of its range, instead of at the end.
With a moving average value of 5, Minitab calculates the average of the first 5 values and plots that
average at position 3.
Centered
With a moving average value of 5, Minitab calculates the average of the first 5 values and plots it at
position 5.
Not centered
If you plot the fitted values, Minitab starts them one position ahead of the moving average values.
Generate forecasts for Moving Average (Forecast tab)
Learn more about Minitab
On the Forecast tab of the Moving Average dialog box, complete the following steps to generate
forecasts for your time series.
1. Select Number of forecasts to generate and enter the number of consecutive time periods that
you want forecasts for.
2. (Optional) Select Generate from origin and enter the row number for the first forecast.
Minitab uses only the data up to that row number for the forecasts. The forecast values differ
from the trend line because Minitab uses all of the data to calculate the trend line values.
Select the graphs for Moving Average (Graphs tab)
Learn more about Minitab
On the Graphs tab of the Moving Average dialog box, select the graphs to include in your output.
Time series plot includes
Specify whether Minitab displays a time series plot with the fitted data or a plot with the smoothed data.
The smoothed data is the level component of the time series. The fitted values are the point estimates
of the variable at time (t).
Residual plots
Select to have Minitab display all four plots.
Residuals versus fits
Display the residuals versus the fitted values. Use the residuals versus fits plot to determine whether the
residuals are unbiased and have a constant variance.
Residuals versus order
Display the residuals versus the order of the data. The row number for each data point is shown on the
x-axis. Use the residuals versus order plot to see how accurate the fitted values are compared to the
observed values during the observation period.
Normal probability plot of residuals
Display a normal probability plot of the residuals. Use the normal plot of residuals to determine whether
the residuals are normally distributed. However, the residuals being normally distributed is not an
assumption that has to be met for this analysis.
Histogram of residuals
Display the shape and spread of the residuals. Use the histogram of residuals to determine whether the
data are skewed or whether outliers exist in the data.
Residuals versus variables
Enter one or more variables to plot versus the residuals. Use the residuals versus the variables plot to
assess whether a variable that is not in the analysis systematically affects the response.
Interpret the results
Interpret the key results for Moving Average
Learn more about Minitab
Complete the following steps to interpret a moving average analysis. Key output includes the moving
average plot, the accuracy measures, and the forecasts.
In This Topic
• Step 1: Determine whether the model fits your data
• Step 2: Compare the fit of your model to other models
• Step 3: Determine whether the forecasts are accurate
Step 1: Determine whether the model fits your data
Examine the smoothing plot to determine whether your model fits your data. If the fits closely follow
the actual data, the model fits your data.
• If the model fits the data, you can perform single exponential smoothing and compare the two
models.
• If the model does not fit the data, examine the plot for trends or seasonality. If you see evidence
of a trend or seasonality, you should use a different time series analysis. For more information,
go to Which time series analysis should I use?.
On this plot, the fits closely follow the data, which indicates that the model fits the data.
Step 2: Compare the fit of your model to other models
Use the accuracy measures (MAPE, MAD, and MSD) to compare the fit of your model to other time
series models. These statistics are not very informative by themselves, but you can use them to compare
the fits obtained by using different methods. For all 3 statistics, smaller values usually indicate a better
fitting model. If a single model does not have the lowest values for all 3 statistics, MAPE is usually the
preferred measurement.
NOTE
The accuracy measures provide an indication of the accuracy you might expect when you forecast out
1 period from the end of the data. Therefore, they do not indicate the accuracy of forecasting out more
than 1 period. If you're using the model for forecasting, you shouldn't base your decision solely on
accuracy measures. You should also examine the fit of the model to ensure that the forecasts and the
model follow the data closely, especially at the end of the series.
Model 1 Model 2
Accuracy Measures Accuracy Measures
MAPE 8.1976 MAPE 6.9551
MAD 3.6215 MAD 2.7506
MSD 22.3936 MSD 11.2702
Key Results: MAPE, MAD, MSD
In these results, all three numbers are lower for the 2nd model compared to the 1st model. Therefore, the
2nd model provides the better fit.
Step 3: Determine whether the forecasts are accurate
Examine the fits and the forecasts in the plot to determine whether the forecasts are likely to be accurate.
The forecasts should generally follow the data at the end of the series. If the fits shift away from the
data at the end of the series, the forecasts may not be accurate. Because the forecasts from moving
average are constant, it is important that there is no trend in the data before the forecasts. If there is a
trend before the forecasts, the forecasts may not be accurate.
The forecasts from moving average are very conservative because they are based solely on the latest
estimate of the level, and no estimate of the trend. You should usually only forecast 6 periods into the
future.
Forecasts
Period Forecast 95% Lower PI 95% Upper PI
102 60.00 52.71 67.29
103 60.00 52.71 67.29
104 60.00 52.71 67.29
105 60.00 52.71 67.29
106 60.00 52.71 67.29
107 60.00 52.71 67.29
On this smoothing plot, the fits closely follow the data, especially at the end of the series. You can
expect sales to be around 58 for the next 6 months with a range of approximately 52 to 65.
Interpret all statistics and graphs for Moving Average
Learn more about Minitab
Find definitions and interpretation guidance for every statistic and graph that is provided with moving
average.
In This Topic
• Moving Average Length • Lower and Upper • Histogram of the
residuals
• MAPE • Moving Average Plot
• Residuals versus order
• MAD • Normal probability plot
of the residuals • Residuals versus
• MSD
variables
• Residuals versus fits
• Forecast
Moving Average Length
The moving average length is the number of consecutive observations that Minitab uses to calculate the
moving averages. For example, for monthly data, a value of 3 indicates that the moving average for
March is the average of the observations from March, February, and January.
The moving average length adjusts the amount of smoothing. Usually, you should smooth the data
enough to reduce the noise (irregular fluctuations) so that the pattern is more apparent. However, don't
smooth the data so much that you lose important details. Lower values produce a less smooth line.
Higher values produce a smoother line.
Moving average = 2 Moving average = 6
MAPE
The mean absolute percent error (MAPE) expresses accuracy as a percentage of the error. Because the
MAPE is a percentage, it can be easier to understand than the other accuracy measure statistics. For
example, if the MAPE is 5, on average, the forecast is off by 5%.
However, sometimes you may see a very large value of MAPE even though the model appears to fit the
data well. Examine the plot to see if any data values are close to 0. Because MAPE divides the absolute
error by the actual data, values close to 0 can greatly inflate the MAPE.
Interpretation
Use to compare the fits of different time series models. Smaller values indicate a better fit. If a single
model does not have the lowest values for all 3 accuracy measures, MAPE is usually the preferred
measurement.
The accuracy measures are based on one-period-ahead residuals. At each point in time, the model is
used to predict the Y value for the next period in time. The difference between the predicted values
(fits) and the actual Y are the one-period-ahead residuals. Because of this, the accuracy measures
provide an indication of the accuracy you might expect when you forecast out 1 period from the end of
the data. Therefore, they do not indicate the accuracy of forecasting out more than 1 period. If you're
using the model for forecasting, you shouldn't base your decision solely on accuracy measures. You
should also examine the fit of the model to ensure that the forecasts and the model follow the data
closely, especially at the end of the series.
MAD
The mean absolute deviation (MAD) expresses accuracy in the same units as the data, which helps
conceptualize the amount of error. Outliers have less of an effect on MAD than on MSD.
Interpretation
Use to compare the fits of different time series models. Smaller values indicate a better fit.
The accuracy measures are based on one-period-ahead residuals. At each point in time, the model is
used to predict the Y value for the next period in time. The difference between the predicted values
(fits) and the actual Y are the one-period-ahead residuals. Because of this, the accuracy measures
provide an indication of the accuracy you might expect when you forecast out 1 period from the end of
the data. Therefore, they do not indicate the accuracy of forecasting out more than 1 period. If you're
using the model for forecasting, you shouldn't base your decision solely on accuracy measures. You
should also examine the fit of the model to ensure that the forecasts and the model follow the data
closely, especially at the end of the series.
MSD
The mean square deviation (MSD) measures the accuracy of the fitted time series values. Outliers have
a greater effect on MSD than on MAD.
Interpretation
Use to compare the fits of different time series models. Smaller values indicate a better fit.
The accuracy measures are based on one-period-ahead residuals. At each point in time, the model is
used to predict the Y value for the next period in time. The difference between the predicted values
(fits) and the actual Y are the one-period-ahead residuals. Because of this, the accuracy measures
provide an indication of the accuracy you might expect when you forecast out 1 period from the end of
the data. Therefore, they do not indicate the accuracy of forecasting out more than 1 period. If you're
using the model for forecasting, you shouldn't base your decision solely on accuracy measures. You
should also examine the fit of the model to ensure that the forecasts and the model follow the data
closely, especially at the end of the series.
Forecast
The forecasts are the fitted values obtained from the time series model. Minitab displays the number of
forecasts that you specify. The forecasts begin either at the end of the data or at the point of origin that
you specify.
Interpretation
Use forecasts to predict a variable for a specified period of time. For example, a warehouse manager
can model how much product to order for the next 3 months based on the previous 60 months of orders.
Examine the fits and the forecasts in the plot to determine whether the forecasts are likely to be accurate.
The forecasts should generally follow the data at the end of the series. If the fits shift away from the
data at the end of the series, the forecasts may not be accurate. Because the forecasts from moving
average are constant, it is important that there is no trend in the data before the forecasts. If there is a
trend before the forecasts, the forecasts may not be accurate.
The forecasts from moving average are very conservative because they are based solely on the latest
estimate of the level, and no estimate of the trend. You should usually only forecast 6 periods into the
future.
Lower and Upper
The lower and upper prediction limits produce a prediction interval for each forecast. The prediction
interval is a range of likely values of forecasts. For example, with a 95% prediction interval, you can
be 95% confident that the prediction interval contains the forecast at the specified time.
Moving Average Plot
The moving average plot displays the observations versus time. The plot includes the fits that are
calculated from the moving averages, the forecasts, the moving average length, and the accuracy
measures. You can also choose to display the smoothed values instead of the fits.
Interpretation
Examine the smoothing plot to determine whether your model fits your data. If the fits closely follow
the actual data, the model fits your data.
• If the model fits the data, you can perform single exponential smoothing and compare the two
models.
• If the model does not fit the data, examine the plot for trends or seasonality. If you see evidence
of a trend or seasonality, you should use a different time series analysis. For more information,
go to Which time series analysis should I use?.
On this plot, the fits closely follow the data, which indicates that the model fits the data.
Normal probability plot of the residuals
The normal plot of the residuals displays the residuals versus their expected values when the distribution
is normal.
Interpretation
Use the normal plot of the residuals to determine whether the residuals are normally distributed.
However, this analysis does not require normally distributed residuals.
If the residuals are normally distributed, the normal probability plot of the residuals should
approximately follow a straight line. The following patterns imply that the residuals are not normally
distributed.
S-curve implies a distribution with long tails. *Inverted S-curve implies a distribution with short
tails.
Downward curve implies a right-skewed distribution. *A few points lying away from the line implies a
distribution with outliers.
Residuals versus fits
The residuals versus fits plot displays the residuals on the y-axis and the fitted values on the x-axis.
Interpretation
Use the residuals versus fits plot to determine whether the residuals are unbiased and have a constant
variance. Ideally, the points should fall randomly on both sides of 0, with no recognizable patterns in
the points.
The patterns in the following table may indicate that the residuals are biased and have a nonconstant
variance.
What the pattern may
Pattern indicate
Fanning or uneven spreading of residuals across fitted Nonconstant variance
values
Curvilinear A missing higher-order term
A point that is far away from zero An outlier
If you see nonconstant variance or patterns in the residuals, your forecasts may not be accurate.
Histogram of the residuals
The histogram of the residuals shows the distribution of the residuals for all observations. lf the model
fits the data well, the residuals should be random with a mean of 0. So the histogram should be
approximately symmetric around 0.
Residuals versus order
The residuals versus order plot displays the residuals in the order that the data were collected.
Interpretation
Use the residuals versus order plot to determine how accurate the fits are compared to the observed
values during the observation period. Patterns in the points may indicate that model does not fit the
data. Ideally, the residuals on the plot should fall randomly around the center line.
The following patterns may indicate that the model does not fit the data.
Pattern What the pattern may indicate
A consistent long-term trend The model does not fit the data
A short-term trend A shift or a change in pattern
A point that is far away from the other points An outlier
A sudden shift in the points The underlying pattern for the data has changed
The following examples show patterns that may indicate that the model does not fit the data.
Residuals systematically decrease as the order of the observations increases from left to right.
A sudden change in the values of the residuals occurs from low (left) to high (right).
Residuals versus variables
The residuals versus variables plot displays the residuals versus another variable.
Interpretation
Use the plot to determine whether the variable affects the response in a systematic way. If patterns are
present in the residuals, the other variables are associated with the response. You can use this
information as the basis for additional studies.
Methods and formulas for Moving Average
Learn more about Minitab
Select the method or formula of your choice.
In This Topic
• Moving average • MAPE
• Centered moving average • MAD
• Forecasts • MSD
• Prediction limits
Moving average
To calculate a moving average, Minitab averages consecutive groups of observations in a series. For
example, suppose a series begins with the numbers 4, 5, 8, 9, 10 and you use the moving average length
of 3. The first two values of the moving average are missing. The third value of the moving average is
the average of 4, 5, 8; the fourth value is the average of 5, 8, 9; the fifth value is the average of 8, 9, 10.
Centered moving average
By default, moving average values are placed at the period in which they are calculated. For example,
for a moving average length of 3, the first numeric moving average value is placed at period 3, the next
at period 4, and so on.
When you center the moving averages, they are placed at the center of the range rather than the end of
it. This is done to position the moving average values at their central positions in time.
If the moving average length is odd
Suppose the moving average length is 3. In that case, Minitab places the first numeric moving average
value at period 2, the next at period 3, and so on. In this case, the moving average value for the first and
last periods is missing ( *).
If the moving average length is even
Suppose the moving average length is 4. Because you cannot place a moving average value at period
2.5, Minitab calculates the average of the first four values and names it MA1. Then Minitab calculates
the average of the next four values and names it MA2. The average of those two values is the number
Minitab and places at period 3. In this case, the moving average values for the first two and last two
periods are missing (*).
Forecasts
The fitted value at time t is the uncentered moving average at time t – 1. The forecasts are the fitted
values at the forecast origin. If you forecast 10 time units ahead, the forecasted value for each time will
be the fitted value at the origin. Data up to the origin are used for calculating the moving averages.
You can use the linear moving average method by performing consecutive moving averages. This is
often done when there is a trend in the data. First, compute and store the moving average of the original
series. Then compute and store the moving average of the previously stored column to obtain a second
moving average.
In naive forecasting, the forecast for time t is the data value at time t – 1. Using moving average
procedure with a moving average of length one gives naive forecasting.
Prediction limits
Formula
Upper limit = Forecast + 1.96 ×
Lower limit = Forecast – 1.96 ×
Notation
Term Description
MSD mean squared deviation
MAPE
Mean absolute percentage error (MAPE) measures the accuracy of fitted time series values. MAPE
expresses accuracy as a percentage.
Term Description
Formula
yt actual value at time t
fitted value
n number of observations
MAD
Mean absolute deviation (MAD) measures the accuracy of fitted time series values. MAD expresses
accuracy in the same units as the data, which helps conceptualize the amount of error.
Formula
Term Description
yt actual value at time t
fitted value
n number of observations
MSD
Mean squared deviation (MSD) is always computed using the same denominator, n, regardless of the
model. MSD is a more sensitive measure of an unusually large forecast error than MAD.
Formula
Term Description
yt actual value at time t
fitted value
n number of observations