Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

blrmStats

Compute Indexes of Predictive Accuracy and Their Uncertainties


Description

For a binary or ordinal logistic regression fit from blrm(), computes several indexes of predictive accuracy along with highest posterior density intervals for them. Optionally plots their posterior densities. When there are more than two levels of the outcome variable, computes Somers' Dxy and c-index on a random sample of 10,000 observations.

Usage

blrmStats(fit, ns = 400, prob = 0.95, pl = FALSE, dist = c("density", "hist"))

Arguments

fit

an object produced by blrm()

ns

number of posterior draws to use in the calculations (default is 400)

prob

HPD interval probability (default is 0.95)

pl

set to TRUE to plot the posterior densities using base graphics

dist

if pl is TRUE specifies whether to plot the density estimate (the default) or a histogram

Value

list of class blrmStats whose most important element is Stats. The indexes computed are defined below, with gp, B, EV, and vp computed using the intercept corresponding to the median value of Y. See https://fharrell.com/post/addvalue for more information.

"Dxy"

Somers' Dxy rank correlation between predicted and observed. The concordance probability (c-index; AUROC in the binary Y case) may be obtained from the relationship Dxy=2(c-0.5).

"g"

Gini's mean difference: the average absolute difference over all pairs of linear predictor values

"gp"

Gini's mean difference on the predicted probability scale

"B"

Brier score

"EV"

explained variation

"v"

variance of linear predictor

"vp"

variable of estimated probabilities

Author(s)

Frank Harrell

See Also

Examples

## Not run: 
  f <- blrm(...)
  blrmStats(f, pl=TRUE)   # print and plot

## End(Not run)

rmsb

Bayesian Regression Modeling Strategies

v0.0.2
GPL (>= 3)
Authors
Frank Harrell [aut, cre] (<https://orcid.org/0000-0002-8271-5493>), Ben Goodrich [ctb] (contributed Stan code), Ben Bolker [ctb] (wrote original code that is folded into the pdensityContour function), Doug Bates [ctb] (write original code for highest posterior density interval that is folded into the HPDint function)
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.