lrcm: Logistic regression classification measures

View source: R/GLM_functions.R

lrcmR Documentation

Logistic regression classification measures

Description

This function computes a variety of classification measures relevant to logistic regression models.

Usage

lrcm(
  roc,
  x = "best",
  best.method = "youden",
  transpose = FALSE,
  ret = "all",
  seed,
  ...
)

Arguments

roc

a "roc" object from the pROC::roc function, or a "smooth.roc" object from the pROC::smooth function.

x

the coordinates to look for. Numeric (if so, their meaning is defined by the input argument) or one of “all” (all the points of the ROC curve), “local maximas” (the local maximas of the ROC curve) or “best” (see best.method argument). If missing or NULL, defaults to “all”.

best.method

if x="best", the method to determine the best threshold. Defaults to "youden". See details in the ‘Best thresholds’ section.

transpose

whether to return the thresholds in columns (TRUE) or rows (FALSE). Since pROC 1.16 the default value is FALSE. See coords_transpose for more details the change.

ret

The coordinates to return. See “Available coordinates” section below. Alternatively, the single value “all” can be used to return every coordinate available.

seed

A single number to be passed to set.seed(), which is used to ensure reproducibility of the bootstrapped confidence intervals.

...

further arguments passed from other methods. Ignored.

Details

=============================================================================

This function is a convnient wrapper around pROC::coords() and pROC::ci.coords(). Most of the arguments are passed along to those functions. What lrcm() does is just gather the results of both estimates and bootstrapped confidence intervals into a data frame. See the details sections of documentetion for pROC::coords() and pROC::ci.coords() for more information. Some information mentioned in the descriptions of individual parameters listed above is absent here because these parameters are inherited from pROC. It is more efficient to refer you to the pROC documentation than to retype it.

Value

A data frame showing estimates and bootstrapped confidence intervals for various classification measures.

References

Robin, X., Turck, N., Hainard, A., Tiberti, N., Lisacek, F., Sanchez, J.-C., & Müller, M. (2011). pROC: an open-source package for R and S+ to analyze and compare ROC curves. BMC Bioinformatics, 12, 77. doi:10.1186/1471-2105-12-77

Youden, W. J. (1950). Index for rating diagnostic tests. Cancer, 3(1), 32-35. doi:10.1002/1097-0142(1950)3

See Also

roc, coords, ci.coords, set.seed.

Examples

 library(pROC)
 m1 <- glm(formula = vs ~ wt + disp, family = binomial, data = mtcars)
 set.seed(4921) # For reproducibility of bootstrap estimates.
 rocm1 <- roc(m1$y ~ predict(m1, type = "response"), ci = TRUE,
              direction = "<", ci.method = "bootstrap")
 print(rocm1)
 lrcm(rocm1, seed = 563)


sjpierce/piercer documentation built on Dec. 30, 2024, 3:28 p.m.