Description Usage Arguments Value References Examples
This function can be used to visualize the performance measures and create a custom classification plot of a model or two competing models. An object is also returned containing the performance measures of the model(s).
1 2 3 4 5 6 7 8 9 10 11 | ClassificationPlot(model1, model2, outcome, data, cutoffs = seq(0, 0.9, by =
0.1), pointwiseCI = c("none", "TPR", "FPR", "both"),
pointwiseCIcutoff = NULL, col1 = "darkgreen", col2 = "red", lwd = 3,
TreatAll = T, colTreatAll = "grey", TreatNone = T,
colTreatNone = "black", SNBpl = T, colSNB = "blue", axes = T,
ShowAUC = T, AUCcoord = c(0.625, 0.95), LegCoord = c(0.75, 1.05),
y.intersp = 0.75, RiskSet = c("model1", "model2", "both", "none"),
cex.leg = 0.75, cex.auc = 0.85, GraphSettings = NULL,
PrintMessages = T, UtilityMeasures = c("default", "accuracy", "utility"),
loc = -0.2, LabelsModels = c("Model 1", "Model 2"), ylab = "Proportion",
...)
|
model1 |
Variable with the risks of the (baseline) model. |
model2 |
Variable with the risks of the competing model. |
outcome |
Response variable. |
data |
Dataframe in which the predicted risks are to be found |
cutoffs |
A vector containing the cutoffs for which the performance measures need to be calculated. |
pointwiseCI |
Can be used to plot the pointwise confidence intervals of the TPR and/or FPR at specific cutoffs.
|
pointwiseCIcutoff |
A vector of cutoffs for which the pointwise confidence intervals have to be calculated. |
col1 |
Color for the lines of the TPR model(s). |
col2 |
Color for the lines of the FPR of the model(s). |
lwd |
Linewidth of the lines in the plot. |
TreatAll |
Logical, indicates if treat all has to be shown on the plot. Default is |
colTreatAll |
Color of treat all. |
TreatNone |
Logical, indicates if treat none has to be shown on the plot. Default is |
colTreatNone |
Color of treat none. |
SNBpl |
Logical, indicates if SNB has to be shown on the plot. Default is |
colSNB |
Color of SNB. |
axes |
Axes command of |
ShowAUC |
Logical, indicates if the AUC has to be shown on the plot. Default is |
AUCcoord |
Vector of length two with the coordinates of the AUCs on the plot. |
LegCoord |
Vector of length two with the coordinates of the legend on the plot. |
y.intersp |
Character interspecing factor for vertical distance. |
RiskSet |
Indicates if performance measures have to be shown (see UtilityMeasures for further specification) below
the plot. Specify |
cex.leg |
Size of the legend. |
cex.auc |
Size of the AUCs shown on the plot. |
GraphSettings |
List with graphical settings. See |
PrintMessages |
Logical, indicates whether messages have to be printed while the function is calculating the
performance measures and preparing the plot. Default is |
UtilityMeasures |
Indicates which performance measures have to be shown for each of the cutoffs. Specify
|
loc |
Specifies the x-coordinates for the titles of the RiskSet. |
LabelsModels |
The labels for the model(s) when |
ylab |
Label for the y-axis. |
... |
Arguments to be passed to |
The classification plot is plotted and an object containing the performance measures of the model(s) is returned.
Verbakel JY, Steyerberg EW, Uno H, De Cock B, Collins G, Van Calster B. From ROC curves to classification plots for markers and models: from wast of ink towards useful insights. Submitted.
Vickers AJ, Elkin EB. Decision Curve Analysis: A Novel Method for Evaluating Prediction Models. Medical Decision Making 2006, 26(6): 565-574
Van Calster B, Vickers A, Pencina M, Baker S, Timmerman D, Steyerberg EW. Evaluation of Markers and Risk Prediction Models: Overview of Relationships between NRI and Decision-Analytic easures. Medical Decision Making 2013, 33(4): 490-501.
Vickers AJ, Van Calster B, Steyerberg EW. Net benefit approaches to the evaluation of prediction models, molecular markers and diagnostic tests. British Medical Journal 2016, 352
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #---------#
# 1 model #
#---------#
# simulated data
X = replicate(4, rnorm(5e2))
p0true = binomial()$linkinv(cbind(1, X)%*%c(0.1, 0.5, 1.2, -0.75, 0.8))
y = rbinom(5e2, 1, p0true)
Df = data.frame(y,X)
# fit logistic model
FitLog = glm(y~., Df, family=binomial)
Pred = binomial()$linkinv(cbind(1, X)%*%coef(FitLog))
Df2 = cbind.data.frame(Pred = Pred, Outcome = y)
# Classification plot
ClassificationPlot(Pred, outcome = Outcome, data=Df2)
#----------#
# 2 models #
#----------#
# Fit second model
FitLog2 = glm(y~., Df[,1:3], family=binomial)
Pred2 = binomial()$linkinv(cbind(1, X[,1:2])%*%coef(FitLog2))
Df3 = cbind.data.frame(Model1 = Pred, Model2 = Pred2, Outcome = y)
# Classification plot
ClassificationPlot(Model1, Model2, Outcome, Df3)
ClassificationPlot(Model1, Model2, Outcome, Df3, RiskSet = "both")
ClassificationPlot(Model1, Model2, Outcome, Df3, RiskSet = "both", UtilityMeasures = "utility")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.