Title: | An Easy Way to Report ROC Analysis |
---|---|
Description: | Provides an easy way to report the results of ROC analysis, including: 1. an ROC curve. 2. the value of Cutoff, AUC (Area Under Curve), ACC (accuracy), SEN (sensitivity), SPE (specificity), PLR (positive likelihood ratio), NLR (negative likelihood ratio), PPV (positive predictive value), NPV (negative predictive value), PPA (percentage of positive accordance), NPA (percentage of negative accordance), TPA (percentage of total accordance), KAPPA (kappa value). |
Authors: | Zhicheng Du, Yuantao Hao |
Maintainer: | Zhicheng Du<[email protected]> |
License: | GPL-3 |
Version: | 3.6 |
Built: | 2025-02-16 03:45:21 UTC |
Source: | https://github.com/cran/reportROC |
This dataset summarizes several clinical and one laboratory variable of 113 patients with an aneurysmal subarachnoid hemorrhage.
aSAH
aSAH
A data.frame containing 113 observations of 7 variables.
Natacha Turck, Laszlo Vutskits, Paola Sanchez-Pena, Xavier Robin, Alexandre Hainard, Marianne Gex-Fabry, Catherine Fouda, Hadiji Bassem, Markus Mueller, Frédérique Lisacek, Louis Puybasset and Jean-Charles Sanchez (2010). A multiparameter panel method for outcome prediction following aneurysmal subarachnoid hemorrhage. Intensive Care Medicine. 36:(1), 107-115. doi:10.1007/s00134-009-1641-y
Xavier Robin, Natacha Turck, Alexandre Hainard, et al. (2011). pROC: an open-source package for R and S+ to analyze and compare ROC curves. BMC Bioinformatics. 7, 77. doi:10.1186/1471-2105-12-77
# load the dataset data(aSAH) # Gender, outcome and set with(aSAH, table(gender, outcome)) # Age with(aSAH, by(age, outcome, mean)) with(aSAH, by(age, outcome, function(x) sprintf("mean: %.1f (+/- %.1f), median: %.1f (%i-%i)", mean(x), sd(x), median(x), min(x), max(x)))) # WFNS score with(aSAH, table(wfns=ifelse(wfns<=2, "1-2", "3-4-5"), outcome))
# load the dataset data(aSAH) # Gender, outcome and set with(aSAH, table(gender, outcome)) # Age with(aSAH, by(age, outcome, mean)) with(aSAH, by(age, outcome, function(x) sprintf("mean: %.1f (+/- %.1f), median: %.1f (%i-%i)", mean(x), sd(x), median(x), min(x), max(x)))) # WFNS score with(aSAH, table(wfns=ifelse(wfns<=2, "1-2", "3-4-5"), outcome))
Provides an easy way to report the results of ROC analysis, including: 1. an ROC curve. 2. the value of Cutoff, AUC (Area Under Curve), ACC (accuracy), SEN (sensitivity), SPE (specificity), PLR (positive likelihood ratio), NLR (negative likelihood ratio), PPV (positive predictive value), NPV (negative predictive value).
reportROC(gold,predictor,predictor.binary,important,positive,exact,plot,xlab,ylab)
reportROC(gold,predictor,predictor.binary,important,positive,exact,plot,xlab,ylab)
gold |
numeric(0/1) or binary, the 'gold standard'; typically encoded with 0 (controls) and 1 (cases) |
predictor |
numeric, the predictor variable |
predictor.binary |
numeric(0/1) or binary, if this argument was used, other arguments including 'predictor' and 'important' would be disabled |
important |
'se' or 'sp', some Youden index maybe the same, and 'important' is to indicate which is more important between sensitivity and specificity |
positive |
logic, 'l': the larger predictor or predictor.binary indicates the 'cases', 's': the smaller one indicates the 'cases' |
exact |
logic, whether to calculate the exact p value for AUC |
plot |
logic, whether to plot the ROC curve with specific style |
xlab |
character, the name of X axis |
ylab |
character, the name of Y axis |
Curoff |
cutoff, only for numeric predictor |
AUC |
Area Under Curve, AUC |
AUC.SE |
the standard error of AUC |
AUC.low , AUC.up
|
the 95 percent CI of AUC |
P |
the p value for AUC using one-sided test, which is different from SPSS using two-sided test |
ACC |
accuracy |
ACC.low , ACC.up
|
the 95 percent CT of accuracy |
SEN , SEN.low , SEN.up
|
the esitmate and the 95 percent CI of sensitivity |
SPE , SPE.low , SPE.up
|
the esitmate and the 95 percent CI of specificity |
PLR , PLR.low , PLR.up
|
the esitmate and the 95 percent CI of positive likelihood ratio |
NLR , NLR.low , NLR.up
|
the esitmate and the 95 percent CI of negative likelihood ratio |
PPV , PPV.low , PPV.up
|
the esitmate and the 95 percent CI of positive predictive value |
NPV , NPV.low , NPV.up
|
the esitmate and the 95 percent CI of negative predictive value |
PPA , PPA.low , PPA.up
|
the esitmate and the 95 percent CI of percentage of positive accordance |
NPA , NPA.low , NPA.up
|
the esitmate and the 95 percent CI of percentage of negative accordance |
TPA , TPA.low , TPA.up
|
the esitmate and the 95 percent CI of percentage of total accordance |
KAPPA , KAPPA.low , KAPPA.up
|
the esitmate and the 95 percent CI of Kappa |
Please feel free to contact us, if you have any advice and find any bug!
Update description:
version 2.0: 1. 95 percent CIs for AUC, SEN, SPE, PLR, NLR, PPV and NPV are available.
version 3.0: 1. binary predictor is available with the new argument 'predictor.binary'. 2. positive indicator is available with the new argument 'positive'.
version 3.1: 1. accuracy is available. 2. roc curve is available for binary predictor.
version 3.2: 1. data with missing values can be handled.
version 3.3: 1. fixed the bug of the same value in 'AUC' and 'AUC.low'.
version 3.4: 1. fixed the axis names of the ROC plot. Thank Cesar S. Rabak ([email protected]) for the useful feedback.
version 3.5: 1. add p value to the outputs.
version 3.6: 1. add PPA, NPA, TPA, and KAPPA to the outputs. 2. limit sensitivity and specificity to a maximum of one. Thank Tengfei Song ([email protected]) for the useful feedback. 3. add the argument 'exact' to avoid the wanring message of "cannot compute exact p-value" in wilcox.test. 4. add the 95 percent CI to AUC in the ROC cruve.
more functions will be included in 'reportROC' package!
Zhicheng Du<[email protected]>, Yuantao Hao<[email protected]>
nothing
data(aSAH) #for continuous variables reportROC(gold=aSAH$outcome,predictor=aSAH$s100b,important="se",plot=TRUE) #for binary variables binary=rep(0,nrow(aSAH)) binary[aSAH$s100b>=0.205]=1 reportROC(gold=aSAH$outcome,predictor.binary=binary) reportROC(gold=aSAH$outcome[1:50],predictor.binary=binary[1:50],exact=FALSE)
data(aSAH) #for continuous variables reportROC(gold=aSAH$outcome,predictor=aSAH$s100b,important="se",plot=TRUE) #for binary variables binary=rep(0,nrow(aSAH)) binary[aSAH$s100b>=0.205]=1 reportROC(gold=aSAH$outcome,predictor.binary=binary) reportROC(gold=aSAH$outcome[1:50],predictor.binary=binary[1:50],exact=FALSE)