plotDiscriminationBox: Function for box plots of predicted risks separately for...

Description Usage Arguments Details Value References See Also Examples

View source: R/PredictABEL.R

Description

The function produces box plots of predicted risks for individuals with and without the outcome of interest and calculates the discrimination slope.

Usage

1
2
plotDiscriminationBox(data, cOutcome, predrisk, labels, plottitle, 
ylabel, fileplot, plottype)

Arguments

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 label is optional. Default is c("Without disease", "With disease").

plottitle

Title of the plot. Specification of plottitle is optional. Default is "Box plot".

ylabel

Label of y-axis. Specification of ylabel is optional. Default is "Predicted risks".

fileplot

Name of the file that contains the plot. The file is saved in the working directory in the format specified under plottype. Example: fileplot="name". Note that the extension is not specified here. When fileplot is not specified, the plot is not saved.

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, plottype="eps" will save the plot in eps format. When plottype is not specified, the plot will be saved in jpg format.

Details

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.

Value

The function creates a box plots of predicted risks for individuals with and without the outcome of interest and returns the discrimination slope.

References

Yates JF. External correspondence: decomposition of the mean probability score. Organizational Behavior and Human Performance 1982;30:132-156.

See Also

reclassification, predRisk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 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)

PredictABEL documentation built on March 13, 2020, 3:15 a.m.