This example illustrates how to use Analytic Solver Data Science's Moving Average Smoothing technique to uncover trends in a time series that contains seasonality. On the Data Science ribbon, from the Applying Your Model tab, select Help - Examples, then Forecasting/Data Mining Examples, and open the example data set, Airpass.xlsx. This data set contains the monthly totals of international airline passengers from 1949-1960.

After the example data set opens, click a cell in the data set, then on the Data Science ribbon, from the Time Series tab, select Partition to open the Time Series Partition Data dialog.

Select Month as the Time Variable, and Passengers as the Variables in the Partition Data. Click OK to partition the data into Training and Validation Sets. (Partitioning is optional. Smoothing techniques may be run on full unpartitioned data sets.)

Time Series Partition Data dialog, Airpass dataset 

The output sheet, TSPartition, will be inserted directly right of the Airpass sheet.  Click Smoothing – Moving Average to open the Moving Average Smoothing dialog. 

Select Month for Time Variable if not already selected.  Select Passengers as the Selected variable.  Since this dataset is expected to include some seasonality (i.e. airline passenger numbers increase during the holidays and summer months), the value for the Interval parameter should be the length of one seasonal cycle, i.e. 12 months.  As a result, enter 12 for Interval.  Select Produce forecast on validation.

Moving Average Smoothing Dialog 

Afterwards, click OK to apply the smoothing technique to the partitioned dataset. 

The report, MovingAvg, will be inserted directly right of TSPartition

The Actual Vs. Fitted: Training and the Actual Vs. Forecast:  Validation charts show that the moving average smoothing technique does not result in a good fit as the model does not effectively capture the seasonality in the dataset.  The summer months where the number of airline passengers are typically high, appear to be under forecasted and the months where the number of airline passengers are low, the model results in a forecast that is too high.  A moving average forecast should never be used when the dataset includes seasonality.  An alternative would be to perform a regression on the model and then apply this technique to the residuals.   

Note:  To view these two charts in the Cloud app, click the Charts icon on the Ribbon, select MovingAvg for Worksheet and Time Series Training Data or Time Series Validation Data for Chart.

Now let’s take a look at an example that does not include seasonality.  Open the example dataset Income.xlsx.  This dataset contains the average income of tax payers by state.  First partition the dataset into training and validation sets using Year as the Time Variable and CA as the Variables in the partition data. 

Time Series Partition Data, Income dataset

Then click OK to accept the partitioning defaults and create the two partitions (Training and Validation).  The output, TSPartition, will be inserted right of the Income sheet..

Click Smoothing – Moving Average from the Data Science ribbon to open the Moving Average Smoothing dialog.  Year is already selected for Time Variable.  Select CA as the Selected variable and Produce forecast on validation checkbox.

Moving Average Smoothing dialog, Income example

Click OK to run the Moving Average Smoothing technique. 

Click MovingAvg, inserted right of the TSPartition worksheet, to view the Actual vs Fitted:  Training and Actual vs. Forecast: Validation charts and Error Measures. 

Note:  To view these two charts in the Cloud app, click the Charts icon on the Ribbon, select MovingAvg for Worksheet and Time Series Training Data or Time Series Validation Data for Chart.

MovingAvg_Stored is available for scoring new data.  Please see the "Scoring New Data" chapter within the Analytic Solver Data Science User Guide for more information on scoring new data using a stored model sheet.