R: Function for predictiveness curve

plotPredictivenessCurve {PredictABEL}R Documentation

Function for predictiveness curve.

Description

The function creates a plot of cumulative percentage of individuals to the predicted risks.

Usage

plotPredictivenessCurve(predrisk, rangeyaxis, labels, plottitle, 
xlabel, ylabel, fileplot, plottype)

Arguments

predrisk

Vector of predicted risk. When multiple curves need to be presented in one plot, specify multiple vectors of predicted risks as predrisk=cbind(predrisk1, predrisk2,...,predriskn).

rangeyaxis

Range of the y axis. Default rangeyaxis is c(0,1).

labels

Label(s) given to the predictiveness curve(s). Specification of labels is optional. When specified, the labels should be in the same order as specified in predrisk.

plottitle

Title of the plot. Specification of plottitle is optional. Default is "Predictiveness curve".

xlabel

Label of x-axis. Specification of xlabel is optional. Default is "Cumulative percentage".

ylabel

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

fileplot

Name of the output file that contains the plot. The file is saved in the working directory in the format specified under plottype. Example: fileplot="plotname". 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. For 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 Predictiveness curve is a plot of cumulative percentage of individuals to the predicted risks. Cumulative percentage indicates the percentage of individual that has a predicted risk equal or lower than the risk value. Predicted risks can be obtained using the functions fitLogRegModel and predRisk or be imported from other methods or packages.

Value

The function creates a predictiveness curve.

References

Pepe MS, Feng Z, Huang Y, et al. Integrating the predictiveness of a marker with its performance as a classifier. Am J Epidemiol 2008;167:362-368.

See Also

predRisk

Examples

# specify dataset with outcome and predictor variables 
data(ExampleData)

# fit logistic regression models
# all steps needed to construct a logistic regression model are written in a function
# called 'ExampleModels', which is described on page 4-5
riskmodel1 <- ExampleModels()$riskModel1
riskmodel2 <- ExampleModels()$riskModel2

# obtain predicted risks
predRisk1 <- predRisk(riskmodel1)
predRisk2 <- predRisk(riskmodel2)

# specify range of y-axis
rangeyaxis <- c(0,1) 
# specify labels of the predictiveness curves
labels <- c("without genetic factors", "with genetic factors")

# produce predictiveness curves
plotPredictivenessCurve(predrisk=cbind(predRisk1,predRisk2),
rangeyaxis=rangeyaxis, labels=labels)