Calculates the median absolute percentage error (MdAPE) between the forecast and the eventual outcomes.
Syntax
MdAPE(X, F, Type)
 X
 is the eventual outcome time series sample data (a onedimensional array of cells (e.g. row or column).
 F
 is the forecast time series data (a onedimensional array of cells (e.g. row or column).
 Type
 is a switch to select the type of calculated MdAPE (0=regular (default), 1=symmetric) .
Order Description 1 MdAPE (default) 2 sMdAPE
Remarks
 The time series is homogeneous or equally spaced.
 The time series X and F must be of identical size
 The time series X or F may include observations with missing values (e.g. #N/A or blank).
 Observations with missing values in Y or F are excluded from the MdAPE calculation.
 The (regular) absolute percentage error (APE) for a given observation is defined as follows:
$$ {\displaystyle {p_t = \left  \frac{y_t  f_t}{y_t} \right  = \left  \frac{e_t}{y_t}\right }} $$
Where:
 $\{y_t\}$ is the actual outcome value at period t.
 $\{f_t\}$ is the forecast value at period t.
 $\{e_i\}$ is the forecast error at period t.
 The symmetric absolute percentage error (SAPE) of a given observation is defined as follows:
$$ {\displaystyle {s_t = \left  \frac{y_t  f_t}{y_t + f_t} \right  = \left  \frac{e_t}{y_t + f_t}\right }} $$  The Median Absolute Percentage Error (MdAPE) is found by ordering the absolute percentage error (APE) from the smallest to the largest, and using its middle value (or the average of the middle two values if N is an even number) as the median:
$${\displaystyle {\mathrm{MdAPE} = \mathrm{median}(p_1,p_2,\cdots,p_N)}}$$  Similarly, the median of the symmetric absolute percentage error is found by ordering the symmetric absolute percentage errors (SAPE), and using the middle value:
$${\displaystyle {\mathrm{sMdAPE} = \mathrm{median}(s_1,s_2,\cdots,s_N)}}$$  MdAPE is more resilient to outliers than MAPE and sMAPE.
 MdAPE is less intuitive, for example an MdAPE of 8% does not mean that the average absolute percentage error is 8%. Instead it means that half of the absolute percentage errors are less than 8% and half are over 8%.
 It is difficult to combine MdAPE across horizons and/or series and when new data becomes available.
 The MdAPE function is available starting with version 1.65 HAMMOCK.
Examples
Example 1:


Formula  Description (Result) 

=MAPE($B$3:$B$21,$C$3:$C$21,1)  MAPE (0.157689) 
=MAPE($B$3:$B$21,$C$3:$C$21,2)  sMAPE (0.155052) 
Files Examples
Related Links
References
 R.J. Hyndman, A.B. Koehler, "Another look at measures of forecast accuracy", International Journal of Forecasting, 22 (2006), pp. 679688
 James Douglas Hamilton; Time Series Analysis; Princeton University Press; 1st edition(Jan 11, 1994), ISBN: 691042896
 Tsay, Ruey S.; Analysis of Financial Time Series; John Wiley & SONS; 2nd edition(Aug 30, 2005), ISBN: 0471690740
 D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
Comments
Article is closed for comments.