Skip to contents

Returns the mean negative log predictive density at the observations. Lower values are better. This score requires positive predictive densities and is particularly sensitive to observations assigned very low density.

Usage

log_score(obs, density_at_obs, na.rm = TRUE)

Arguments

obs

Numeric observation vector, retained for length checking.

density_at_obs

Numeric vector of strictly positive predictive-density values evaluated at each corresponding observation.

na.rm

Logical; remove incomplete pairs?

Value

One numeric score.

Details

$$\mathrm{Log\ score} = -\frac{1}{n}\sum_{i=1}^{n}\log f_i(obs_i)$$

Lower values are better. The score strongly penalizes assigning near-zero density to observations, so it is useful for comparing full predictive distributions but can be dominated by tail failures.

References

Gneiting, T. and Raftery, A. E. (2007). Strictly proper scoring rules, prediction, and estimation. JASA, 102, 359-378. doi:10.1198/016214506000001437

Examples

log_score(0, stats::dnorm(0))
#> [1] 0.9189385