murphy_diagram: Murphy diagram

View source: R/murphy_diagram.R

murphy_diagramR Documentation

Murphy diagram

Description

Murphy diagram of the elementary scoring function for expectiles/quantiles at level \alpha for different values of \theta. Can be used to study and compare performance of one or multiple models.

Usage

murphy_diagram(
  actual,
  predicted,
  w = NULL,
  alpha = 0.5,
  theta = seq(-2, 2, length.out = 100L),
  functional = c("expectile", "quantile"),
  plot = TRUE,
  ...
)

Arguments

actual

Observed values.

predicted

Predicted values.

w

Optional case weights.

alpha

Level of expectile or quantile. The default alpha = 0.5 corresponds to the expectation/median.

theta

Vector of evaluation points.

functional

Either "expectile" or "quantile".

plot

Should a plot be returned (default is TRUE)? If FALSE, a data.frame containing the results.

...

Further arguments passed to graphics::matplot().

Details

If the plot needs to be customized, set plot = FALSE to get the resulting data instead of the plot.

Value

The result of graphics::matplot() or a data.frame containing the results.

References

Ehm, W., Gneiting, T., Jordan, A. and Krüger, F. (2016), Of quantiles and expectiles: consistent scoring functions, Choquet representations and forecast rankings. J. R. Stat. Soc. B, 78: 505-562, <doi.org/10.1111/rssb.12154>.

See Also

elementary_score()

Examples

y <- 1:10
predicted <- 1.1 * y
murphy_diagram(y, predicted, theta = seq(0.9, 1.2, by = 0.01))
two_models <- cbind(m1 = predicted, m2 = 1.2 * y)
murphy_diagram(y, two_models, theta = seq(0.9, 1.3, by = 0.01))

MetricsWeighted documentation built on Nov. 16, 2023, 5:09 p.m.