## UFORERRORS - Analysis of (univariate) forecast errors

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.

### 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.src
Procedure file (requires RATS 7.3 or later)

@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 / ma3filter(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) forecastsFrom 4 to 11Mean Error                  17.7083333Mean Absolute Error         71.4583333Root Mean Square Error      79.9728687Mean Square Error          6395.659722Theil's U                     1.064827Mean Pct Error               -0.012779Mean Abs Pct Error            0.348937Root Mean Square Pct Error    0.387478Theil's Relative U            1.150330`
TomDoan

Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm