R: Function for predictiveness curve

plotPredictivenessCurve {PredictABEL}R Documentation

Function for predictiveness curve.


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


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



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


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


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.


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


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


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


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.


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.


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.


The function creates a predictiveness curve.


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



# specify dataset with outcome and predictor variables 

# 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
rangeyaxis=rangeyaxis, labels=labels)