FORECAST_DOUBLEXP: Using Double Exponential Smoothing
Double exponential smoothing produces an exponential moving average that takes into account the tendency of data to either increase or decrease over time without repeating. This is accomplished by using two equations with two constants.
- The first equation
accounts for the current time period and is a weighted average of
the current data value and the prior average, with an added component
(b) that represents the trend for the previous period. The weight
constant is k:
DOUBLEXP(t) = k * datavalue(t) + (1-k) * ((DOUBLEXP(t-1) + b(t-1))
- The second equation
is the calculated trend value, and is a weighted average of the
difference between the current and previous average and the trend
for the previous time period. b(t) represents the average
trend. The weight constant is g:
b(t) = g * (DOUBLEXP(t)-DOUBLEXP(t-1)) + (1 - g) * (b(t-1))
These two equations are solved to derive the smoothed average. The first smoothed average is set to the first data value. The first trend component is set to zero. For choosing the two constants, the best results are usually obtained by minimizing the mean-squared error (MSE) between the data values and the calculated averages. You may need to use nonlinear optimization techniques to find the optimal constants.
The equation used for forecasting beyond the data points with double exponential smoothing is
forecast(t+m) = DOUBLEXP(t) + m * b(t)
where:
Is the number of time periods ahead for the forecast.
Calculate a Double Exponential Smoothing Column
FORECAST_DOUBLEXP(display, infield, interval, npredict, npoint1, npoint2)
where:
Keyword
Specifies which values to display for rows of output that represent existing data. Valid values are:
- INPUT_FIELD. This displays the original field values for rows that represent existing data.
- MODEL_DATA. This displays the calculated values for rows that represent existing data.
Is any numeric field. It can be the same field as the result field, or a different field. It cannot be a date-time field or a numeric field with date display options.
Is the increment to add to each sort field value (after the last data point) to create the next value. This must be a positive integer. To sort in descending order, use the BY HIGHEST phrase. The result of adding this number to the sort field values is converted to the same format as the sort field.
For date fields, the minimal component in the format determines how the number is interpreted. For example, if the format is YMD, MDY, or DMY, an interval value of 2 is interpreted as meaning two days. If the format is YM, the 2 is interpreted as meaning two months.
Is the number of predictions for FORECAST to calculate. It must be an integer greater than or equal to zero. Zero indicates that you do not want predictions, and is only supported with a non-recursive FORECAST.
k=2/(1+npoint1)
For DOUBLEXP, this positive whole number is used to calculate the weights for each term in the trend. The weight, g, is calculated by the following formula:
g=2/(1+npoint2)
Calculating a Double Exponential Smoothing Column
The following sums the TRANSTOT field of the VIDEOTRK data source by TRANSDATE, and calculates a single exponential and double exponential moving average. The report columns show the calculated values for existing data points.
TABLE FILE VIDEOTRK SUM TRANSTOT COMPUTE EXP/D15.1 = FORECAST_EXPAVE(MODEL_DATA,TRANSTOT,1,0,3); DOUBLEXP/D15.1 = FORECAST_DOUBLEXP(MODEL_DATA,TRANSTOT,1,0,3,3); BY TRANSDATE WHERE TRANSDATE NE '19910617' ON TABLE SET STYLE * GRID=OFF,$ END
The output is shown in the following image:
