Skip to contents

Mean squared logarithmic error (MSLE) averages squared differences on the log1p scale.

Usage

msle(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{MSLE}=\frac{1}{n}\sum_{i=1}^n [\log(1+obs_i)-\log(1+pred_i)]^2.$$

MSLE is non-negative and zero is ideal. It emphasizes relative differences and requires non-negative observations and predictions; otherwise it returns NA with a warning. The log1p convention is a package choice. Missing-value handling follows bias().

References

Hodson, T. O. (2022). Root mean square error (RMSE) or mean absolute error (MAE): When to use them or not. Geoscientific Model Development, 15, 5481-5487. doi:10.5194/gmd-15-5481-2022

See also