plotDiscriminationBox {PredictABEL} | R Documentation |
The function produces box plots of predicted risks for individuals with and without the outcome of interest and calculates the discrimination slope.
plotDiscriminationBox(data, cOutcome, predrisk, labels, plottitle, ylabel, fileplot, plottype)
data |
Data frame or matrix that includes the outcome and predictors variables. |
cOutcome |
Column number of the outcome variable. |
predrisk |
Vector of predicted risks. |
labels |
Labels given to the groups of individuals without and with
the outcome of interest. Specification of |
plottitle |
Title of the plot. Specification of |
ylabel |
Label of y-axis. Specification of |
fileplot |
Name of the file that contains the plot. The file is
saved in the working directory in the format specified under |
plottype |
The format in which the plot is saved. Available formats are
wmf, emf, png, jpg, jpeg, bmp, tif, tiff, ps,
eps or pdf. Foe example, |
The discrimination slope is the difference between the mean predicted risks
of individuals with and without the outcome of interest. Predicted risks
can be obtained using the
fitLogRegModel
and predRisk
or be
imported from other programs. The difference between discrimination
slopes of two separate risk models is equivalent
to (IDI
) which is discussed
in details in the reclassification
function.
The function creates a box plots of predicted risks for individuals with and without the outcome of interest and returns the discrimination slope.
Yates JF. External correspondence: decomposition of the mean probability score. Organizational Behavior and Human Performance 1982;30:132-156.
# specify dataset with outcome and predictor variables data(ExampleData) # specify column number of outcome variable cOutcome <- 2 # fit a logistic regression model # all steps needed to construct a logistic regression model are written in a function # called 'ExampleModels', which is described on page 4-5 riskmodel <- ExampleModels()$riskModel2 # obtain predicted risks predRisk <- predRisk(riskmodel) # specify labels for the groups without and with the outcome of interest labels <- c("Without disease", "With disease") # produce discrimination box plot plotDiscriminationBox(data=ExampleData, cOutcome=cOutcome, predrisk=predRisk, labels=labels)