SMOOTHIE: Interactive Time--Series Analysis
by Richard S. Barr and James Collins
SMOOTHIE is an interactive program for time--series data that permits the application of several forecasting models to a set of data. The user can apply single and double exponential smoothing, moving average, trend, arithmetic mean, and complete decomposition methods to a given data series.
Running SMOOTHIE
Prepare a data file using a text editor and the instructions below. To execute the program, type the following at the DOS prompt:
SMOOTHIE filename
where filename is the name of the data file. If filename is omitted, operating instructions are displayed.
Data File Organization
The data file contains a set of time--series data in free format. That is, it consists of a series of observed values for a single variable, taken at uniform time intervals, given in chronological order, and separated by blanks or on separate lines.
The following example file will be used below to illustrate the use of the program, and is assumed to be in the file named MYFILE.
13.1 12 15.8 11.4 14 15.3 17.6 13 15.2 16.4 19.2 14.7 15.6 15.5 17.2 16.7 16.8 16.5 17.4 14.4 17.0 19.4 19.2 16.7
There are 25 observations of a variable, given in time--series order.
Program Operation and Report Interpretation
In the sections that follow, user input will be shown in underlined boldface. To process the above data file, we enter:
SMOOTHIE myfile
The initial screen displays:
*** SMTHIE: INTERACTIVE TIME--SERIES FORECASTING ***
by RichOOard S. Barr and Jim Collins
Processing data file smoothie.dat
24 observations were read
How many observations to use in the mean error calculation (enter 0 for the maximum possible)? 5
The user is asked to enter the number of observations to be used in calculating cumulative error values, such as mean squared error (MSE). Since the models result in varying numbers of historical error terms, one may wish to use a subset in computing cumulatives, if the values are to be compared across models. We have asked that only the most recent five error values be used.
*** SMOOTHIE: INTERACTIVE TIME--SERIES FORECASTING ***
The following forecasting models are available:
Moving average
Exponential smoothing (single)
Smoothing with trend (double)
Trend
Arithmetic mean
Decomposition
Select model by typing the first letter, or ESC to quit:
Any of the six models listed may be applied to the dataset. A model is selected by typing its first letter, such as “M” for moving average.
Each model type results in a different forecast methodology and set of reports. The output for each model as applied to our dataset is given below.
NOTE:
To prevent reports from scrolling off of the screen before viewing by the user, output pauses at the end of each full screen. This condition is indicated by a “&” symbol, and the user may press any key to continue.
M, Moving Average Forecasts
Moving average forecasting is selected at the main menu by the “M” key. The user is then asked to enter the number of periods to be used in the averaging process. In our example, we will perform a 3--period moving average.
*** MOVING AVERAGE METHOD ***
Number of periods for your moving average: 3
*** SUMMARY REPORT ***
Period Actual Forecast Error
Number Observn for Next (Forecast--
Period Actual)
------ ------- -------- ---------
1 13.100
2 12.000
3 15.800 13.633
4 11.400 13.067 -2.233
5 14.000 13.733 0.933
6 15.300 13.567 1.567
7 17.600 15.633 4.033
8 13.000 15.300 -2.633
9 15.200 15.267 -0.100
10 16.400 14.867 1.133
11 19.200 16.933 4.333
12 14.700 16.767 -2.233
13 15.600 16.500 -1.167
14 15.500 15.267 -1.000
15 17.200 16.100 1.933
16 16.700 16.467 0.600
17 16.800 16.900 0.333
18 16.500 16.667 -0.400
19 17.400 16.900 0.733
20 14.400 16.100 -2.500
21 17.000 16.267 0.900
22 19.400 16.933 3.133
23 19.200 18.533 2.267
24 16.700 18.433 -1.833
*** FORECAST ERROR MEASURES ***
Specified Maximum
Number of periods 5 21
Mean squared error (MSE) 5.075 4.249
Mean absolute error (MAD) 2.127 1.714
Mean absolute pct error (MAPE) 12.318 10.666
Mean error/Forecast bias 0.393 0.371
E, Single Exponential Smoothing
When “E" is chosen from the main menu, and a smoothing constant (a) of 0.5 is selected, the following reports result.
*** EXPONENTIAL SMOOTHING (SINGLE) ***
What smoothing constant do you wish to use (0 < a < 1)? 0.5
*** SUMMARY REPORT ***
Period Actual Forecast Error
Number Observn for Next (Forecast-
------ ------- -------- ---------
1 13.100 13.100
2 12.000 12.550 -1.100
3 15.800 14.175 3.250
4 11.400 12.788 -2.775
5 14.000 13.394 1.212
6 15.300 14.347 1.906
7 17.600 15.973 3.253
8 13.000 14.487 -2.973
9 15.200 14.843 0.713
10 16.400 15.622 1.557
11 19.200 17.411 3.578
12 14.700 16.055 -2.711
13 15.600 15.828 -0.455
14 15.500 15.664 -0.328
15 17.200 16.432 1.536
16 16.700 16.566 0.268
17 16.800 16.683 0.234
18 16.500 16.591 -0.183
19 17.400 16.996 0.809
20 14.400 15.698 -2.596
21 17.000 16.349 1.302
22 19.400 17.874 3.051
23 19.200 18.537 1.326
24 16.700 17.619 -1.837
*** FORECAST ERROR MEASURES ***
Specified Maximum
Number of periods 5 23
Mean squared error (MSE) 4.575 4.063
Mean absolute error (MAD) 2.022 1.694
Mean absolute pct error (MAPE) 11.864 10.863
Mean error/Forecast bias 0.249 0.393
S, Smoothing with Trend (Double)
Double exponential smoothing uses both a smoothing constant, a, but a trend emphasis constant, b. Both values are between 0 and 1.
*** EXPONENTIAL SMOOTHING WITH TREND (DOUBLE) ***
What DATA smoothing constant do you wish to use (0 < a < 1)? 0.5
What TREND smoothing constant do you wish to use (0 < b < 1)? 0.6
Forecast using 18.340528 + 0.094073 * (number of periods beyond 24)
*** SUMMARY REPORT ***
Period Actual Forecast Error
Number Observn for Next (Forecast-
Period Actual)
------ ------- -------- ---------
1 13.100 13.100
2 12.000 12.220 -1.100
3 15.800 14.754 3.580
4 11.400 12.815 -3.354
5 14.000 13.501 1.185
6 15.300 15.034 1.799
7 17.600 17.720 2.566
8 13.000 15.347 -4.720
9 15.200 15.217 -0.147
10 16.400 16.106 1.183
11 19.200 18.879 3.094
12 14.700 16.762 -4.179
13 15.600 15.805 -1.162
14 15.500 15.185 -0.305
15 17.200 16.329 2.015
16 16.700 16.763 0.371
17 16.800 17.041 0.037
18 16.500 16.867 -0.541
19 17.400 17.391 0.533
20 14.400 15.255 -2.991
21 17.000 16.011 1.745
22 19.400 18.605 3.389
23 19.200 19.981 0.595
24 16.700 18.435 -3.281
*** FORECAST ERROR MEASURES ***
Specified Maximum
Number of periods 5 23
Mean squared error (MSE) 6.919 5.568
Mean absolute error (MAD) 2.400 1.907
Mean absolute pct error (MAPE) 14.250 12.445
Mean error/Forecast bias -0.109 0.014
T, Trend
Forecasting with a trend line only involved fitting a simple regression line to the observed points, using the period number as the independent variable.
*** LEAST--SQUARES TREND LINE ***
Trend equation: T = 13.352174 + 0.198826 * t
Sample coefficient of determination (R--squared) = 0.433809
*** SUMMARY REPORT ***
Period Actual Forecast Error
Number Observn for Next (Forecast-
Period Actual)
------ ------- -------- ---------
1 13.100 13.100
2 12.000 10.900 -1.100
3 15.800 16.333 4.900
4 11.400 12.750 -4.933
5 14.000 13.620 1.250
6 15.300 14.860 1.680
7 17.600 16.786 2.740
8 13.000 15.546 -3.786
9 15.200 15.731 -0.346
10 16.400 16.313 0.669
11 19.200 17.715 2.887
12 14.700 17.192 -3.015
13 15.600 17.069 -1.592
14 15.500 16.935 -1.569
15 17.200 17.275 0.265
16 16.700 17.408 -0.575
17 16.800 17.528 -0.608
18 16.500 17.551 -1.028
19 17.400 17.753 -0.151
20 14.400 17.313 -3.353
21 17.000 17.437 -0.313
22 19.400 17.973 1.963
23 19.200 18.389 1.227
24 16.700 18.323 -1.689
*** FORECAST ERROR MEASURES ***
Specified Maximum
Number of periods 5 23
Mean squared error (MSE) 3.910 5.225
Mean absolute error (MAD) 1.709 1.810
Mean absolute pct error (MAPE) 10.350 12.075
Mean error/Forecast bias -0.433 -0.282
A, Arithmetic Mean
The average of all previous observations can be used as a forecast, as follows.
*** ARITHMETIC MEAN AS A FORECAST ***
The overall mean of Y is 15.837500
*** SUMMARY REPORT ***
Period Actual Forecast Error
Number Observn for Next (Forecast-
Period Actual)
------ ------- -------- --------- 1 13.100 13.100
2 12.000 12.550 -1.100
3 15.800 13.633 3.250
4 11.400 13.075 -2.233
5 14.000 13.260 0.925
6 15.300 13.600 2.040
7 17.600 14.171 4.000
8 13.000 14.025 -1.171
9 15.200 14.156 1.175
10 16.400 14.380 2.244
11 19.200 14.818 4.820
12 14.700 14.808 -0.118
13 15.600 14.869 0.792
14 15.500 14.914 0.631
15 17.200 15.067 2.286
16 16.700 15.169 1.633
17 16.800 15.265 1.631
18 16.500 15.333 1.235
19 17.400 15.442 2.067
20 14.400 15.390 -1.042
21 17.000 15.467 1.610
22 19.400 15.645 3.933
23 19.200 15.800 3.555
24 16.700 15.837 0.900
*** FORECAST ERROR MEASURES ***
Specified Maximum
Number of periods 5 23
Mean squared error (MSE) 6.519 5.164
Mean absolute error (MAD) 2.208 1.930
Mean absolute pct error (MAPE 12.177 11.761
Mean error/Forecast bias 1.791 1.437
D, Decomposition
Time--series decomposition separates the observations into four components: trend, seasonal, cyclical, and irregular/random. The multiplicative model is of the form: . The user can then assemble a forecast for a future period by estimating its cyclical index (a value of 1.0 can be used to ignore this component). A detailed historical decomposition report is available as a use option.
For computing the seasonal component, the user must indicate whether the observations are monthly or quarterly data values. The sample dataset is based on quarterly observations.
*** TIME SERIES DECOMPOSITION ***
Is the data monthly or quarterly (M/Q)? Q
Quarterly Trend equation: T = 13.657547 + 0.178496 * Period Sample coefficient of determination (R--squared) = 0.826790
Season Seasonal Index
--—--—--— --—--—--—--—--—--—--—
Quarter 1 0.9794
Quarter 2 1.0167
Quarter 3 1.1347
Quarter 4 0.8693
Modified means used in 4 seasonal index calculations
Mean irregular index = 1.005263
Do you want a detailed report (Y/N)? Y
D E C O M P O S I T I O N S U M M A R Y
Period Actual Trend Seasonal Cyclical Forecast Error
3 15.800 14.193 1.135 0.929 16.105 -0.305
4 11.400 14.372 0.869 0.954 12.493 -1.093
-- ------ ------ ----- ----- ------ ------
5 14.000 14.550 0.979 0.986 14.250 -0.250
6 15.300 14.729 1.017 1.003 14.974 0.326
7 17.600 14.907 1.135 1.015 16.915 0.685
-- ------ ------ ----- ----- ------ ------
9 15.200 15.264 0.979 1.032 14.949 0.251
10 16.400 15.443 1.017 1.047 15.700 0.700
11 19.200 15.621 1.135 1.051 17.725 1.475
12 14.700 15.800 0.869 1.036 13.734 0.966
-- ------ ------ ----- ----- ------ ------
13 15.600 15.978 0.979 1.001 15.648 -0.048
14 15.500 16.156 1.017 0.990 16.426 -0.926
15 17.200 16.335 1.135 1.004 18.535 -1.335
16 16.700 16.513 0.869 1.010 14.355 2.345
-- ------ ------ ----- ----- ------ ------
17 16.800 16.692 0.979 1.008 16.348 0.452
18 16.500 16.870 1.017 0.982 17.152 -0.652
19 17.400 17.049 1.135 0.956 19.345 -1.945
20 14.400 17.227 0.869 0.969 14.975 -0.575
-- ------ ------ ----- ----- ------ ------
21 17.000 17.406 0.979 0.992 17.047 -0.047
22 19.400 17.584 1.017 1.012 17.878 1.522
Forecast based on trend and seasonal only
Mean squared error for periods 3 through 22 = 1.040293
*** INTERACTIVE FORECASTING ***
Period to forecast or 0? 30
Cyclical index to use or 1 to ignore? 1
Forecast = Trend * Seasonal Index * Cyclical Index 19.329 = 19.012 * 1.017 * 1.000
Period to forecast or 0? 0
Exiting SMOOTHIE
To exit the system, press the Escape key from the main menu.