Learn R Programming

ham (version 1.2.0)

plot.decide: Decision Curve Analysis plots and regression model classification graphs on sensitivity and specificity

Description

Graph decide class object's model classification results as well as Decision Curve analysis output for net benefit and interventions saved.

Usage

# S3 method for decide
plot(
  x,
  y = NULL,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  lwd = NULL,
  bcol = NULL,
  lcol = NULL,
  add.legend = NULL,
  legend = NULL,
  cex = 1,
  cex.lab = NULL,
  cex.axis = NULL,
  cex.main = NULL,
  cex.legend = NULL,
  round.c = 2,
  ...
)

Value

plots of model classification, net benefit, and interventions saved.

Arguments

x

decide object.

y

type of plot to display. Select either 'nb', 'is', or 'cl' for a decision curve analysis 'net benefit' and 'interventions saved', or a model classification (e.g., sensitivity and specificity) according to a selected threshold. Net benefit and interventions saved display results for specific percentiles found between the 1st and 99th percentiles. Default is 'nb'.

main

the main title of the plot.

xlab

a character vector label for the x-axis.

ylab

a character vector label for the y-axis.

xlim

specify plot's x-axis limits with a 2 element numeric vector.

ylim

specify plot's y-axis limits with a 2 element numeric vector. When y='is', the y-axis labels are in integers (e.g., 1 to 100) but the actual scale is in decimals (0.0 to 1.0), please note when making y-axis limits.

lwd

select the line width.

bcol

a multiple element character vector of length == 2 to specify the bar, band, or block colors that are the shading of the true and false classification regions of the plot (e.g., true-positive and false-negative). When y='cl', the first color represents 'true' and the second color is for 'negative'. Default is null, if none selected, the colors are c('green', 'red').

lcol

a single or multiple element character vector to specify the line color(s). When y='nb', select up to 3 colors in this order for model, 'net benefit', 'all treated', and 'none treated' line colors. When y='is', select 1 color for the interventions saved line. And when y='cl', select 1 color to represent the selected threshold.

add.legend

add a legend by selecting the location as "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right", "center". Default is no legend produced if nothing is selected.

legend

a character vector of length >= 2 to appear when y='nb' and y='cl' with legend description.

cex

A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default of 1.

cex.lab

The magnification to be used for x and y labels relative to the current setting of cex.

cex.axis

The magnification to be used for axis annotation relative to the current setting of cex.

cex.main

The magnification to be used for main titles relative to the current setting of cex.

cex.legend

The magnification to be used for the legend added into the plot relative to the current setting of 1.

round.c

an integer indicating the number of decimal places when rounding numbers y='multi' and y='target'. Default is 2.

...

additional arguments.

References

Vickers, A. & Elkin, E. (2006). Decision Curve Analysis: A Novel Method for Evaluating Prediction Models. Society for Medical Decision Making, 26, 6, 565-574. https://doi.org/10.1177/0272989X06295361

Examples

Run this code
## Predicting car engine shape type, v or straight  ##
# run the model
car_m1 <- assess(formula=vs ~ hp + am, data=mtcars, regression="logistic")
# create a decide object, enter the model name and a threshold on the logit scale
d1 <- decide(x=car_m1, threshold= -0.767)
#Plot the classification results
plot(x=d1, y= "cl")

#Plot the net benefit
plot(x=d1, y= "nb")

#Plot the interventions saved
plot(x=d1, y= "is")

Run the code above in your browser using DataLab