ClassificationPlot: Classification plot

Description Usage Arguments Value References Examples

Description

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).

Usage

 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",
  ...)

Arguments

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. "TPR" when this needs to be plotted for the TPR, "FPR" when this only needs to be plotted for the FPR and "both" when it has to be plotted for both the FPR and TPR.

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 TRUE.

colTreatAll

Color of treat all.

TreatNone

Logical, indicates if treat none has to be shown on the plot. Default is TRUE.

colTreatNone

Color of treat none.

SNBpl

Logical, indicates if SNB has to be shown on the plot. Default is TRUE.

colSNB

Color of SNB.

axes

Axes command of plot, default is TRUE. If set to FALSE, only the y- and x-axis will be shown on the plot.

ShowAUC

Logical, indicates if the AUC has to be shown on the plot. Default is TRUE.

AUCcoord

Vector of length two with the coordinates of the AUCs on the plot. locator can also be used.

LegCoord

Vector of length two with the coordinates of the legend on the plot. locator can also be used.

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 'model1' for the performance measures of model 1, 'model2' for those of model 2 and 'both' if the performance measures for both models have to be shown.. 'none' suppresses the printing. Default is 'model1'.

cex.leg

Size of the legend.

cex.auc

Size of the AUCs shown on the plot.

GraphSettings

List with graphical settings. See par.

PrintMessages

Logical, indicates whether messages have to be printed while the function is calculating the performance measures and preparing the plot. Default is TRUE.

UtilityMeasures

Indicates which performance measures have to be shown for each of the cutoffs. Specify 'default' for the true and false positive rate (TPR and FPR, respectively) and 'accuracy' to additionally show the positive likelihood ratio (PLR), negative likelihood ratio (NLR), positive predictive value (PPV) and negative predictive value (NPV). 'Utility' shows the TPR, FPR, standardized net benefit (SNB), net TP per 100 and NNT for 1 TP if the predicted risks of one model are given. In case of 2 models, the TPR and FPR for both models are given as well as the difference in SNB and the difference in net TP per 100. Only possible for the default cutoffs. Default is 'proportions'.

loc

Specifies the x-coordinates for the titles of the RiskSet.

LabelsModels

The labels for the model(s) when Riskset!='none'.

ylab

Label for the y-axis.

...

Arguments to be passed to plot, see par.

Value

The classification plot is plotted and an object containing the performance measures of the model(s) is returned.

References

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

Examples

 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")

BavoDC/ClassificationPlot documentation built on June 26, 2019, 4:40 a.m.