Skip to contents

Mean percentage error (MPE) is signed mean error relative to observations, reported in percent.

Usage

mpe(obs, pred, na.rm = TRUE)

Arguments

obs

Numeric observation vector.

pred

Numeric prediction vector paired with obs.

na.rm

Logical; remove incomplete pairs?

Value

One numeric value.

Details

$$\mathrm{MPE}=\frac{100}{n}\sum_{i=1}^n\frac{obs_i-pred_i}{obs_i}.$$

MPE is unbounded and zero is ideal. For strictly positive observations, positive values indicate underprediction. Relative errors can cancel; MPE is undefined for zero observations, returning NA with a warning, and unstable near zero. Missing-value handling follows bias().

References

Hyndman and Koehler (2006). See mdae().

See also