UFORERRORS - Analysis of (univariate) forecast errors
UForeErrors computes error statistics on a series of in-sample one-step forecasts. You supply the series of actual data and forecasts and it computes statistics such as the mean and root mean square errors.
@UForeErrors( options ) actual forecast start end
Parameters
Options
[print]/noprint
title=descriptive title for forecasts
theildecomp/[notheildecomp]
window=title for report window [not used]
Variables Defined
Example
Sample Output
@UForeErrors( options ) actual forecast start end
Parameters
| actual | series of actual values |
| forecast | series of forecasts |
| start end | range of forecasts to analyze (by default, the range of the series forecast) |
Options
[print]/noprint
title=descriptive title for forecasts
theildecomp/[notheildecomp]
window=title for report window [not used]
Variables Defined
| %%FERRMEAN | mean forecast error |
| %%FERRMAE | mean absolute error |
| %%FERRMSE | root mean square error |
| %%FERRMPE | mean percentage error |
| %%FERRMAPE | mean absolute percentage error |
| %%FERRMSPE | root mean square percentage error |
Example
- Code: Select all
*
* Makridakis et al, Forecasting Methods and Applications, 3rd edition
* Example of moving average smoothing, pp 143-145
*
data(unit=input) 1 11 shipments
200 135 195 197.5 310 175 155 130 220 277.5 235
*
* The filter instruction with TYPE=LAGGING computes the average of the
* input data for periods t,t-1,...,t-span+1
*
filter(type=lagging,span=3) shipments / ma3
filter(type=lagging,span=5) shipments / ma5
*
* The forecast values for t is just the smoothed value for t-1. This
* instruction handles that.
*
set ma3fore = ma3{1}
set ma5fore = ma5{1}
*
* This analyzes the forecasts errors
*
@uforeerrors(title="MA(3) forecasts") shipments ma3fore
@uforeerrors(title="MA(5) forecasts") shipments ma5fore
*
graph(footer="Figure 4-4 Shipments of Electric Can Openers with Moving Average Forecasts",$
key=attached,klabels=||"Observed values","MA(3)","MA(5)"||) 3
# shipments
# ma3fore
# ma5fore
Sample Output
- Code: Select all
MA(3) forecasts
From 4 to 11
Mean Error 17.7083333
Mean Absolute Error 71.4583333
Root Mean Square Error 79.9728687
Mean Square Error 6395.659722
Theil's U 1.064827
Mean Pct Error -0.012779
Mean Abs Pct Error 0.348937
Root Mean Square Pct Error 0.387478
Theil's Relative U 1.150330