Function to plot posterior risks against prior risks.
Description
Function to plot posterior risks against prior risks.
Usage
1 2  plotPriorPosteriorRisk(data, priorrisk, posteriorrisk, cOutcome, plottitle,
xlabel, ylabel, rangeaxis, plotAll=TRUE, labels, filename, fileplot, plottype)

Arguments
data 
Data frame or matrix that includes the outcome and predictors variables. 
priorrisk 
Vector of predicted risks based on initial model. 
posteriorrisk 
Vector of predicted risks based on updated model. 
cOutcome 
Column number of the outcome variable. 
plottitle 
Title of the plot. Specification of 
xlabel 
Label of xaxis. Specification of 
ylabel 
Label of yaxis. Specification of 
rangeaxis 
Range of xaxis and yaxis. Specification of 
plotAll 

labels 
Labels given to the groups of individuals without and with
the outcome of interest. Default 
filename 
Name of the output file in which prior and posterior
risks for each individual with the outcome will be saved. If no directory is
specified, the file is saved in the working directory as a txt file.
When no 
fileplot 
Name of the output 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. For example, 
Details
The function creates a plot of posterior risks (predicted risks using
the updated model) against prior risks (predicted risks using the initial
model). Predicted risks can be obtained using the functions
fitLogRegModel
and predRisk
or be
imported from other packages or methods.
Value
The function creates a plot of posterior risks against prior risks.
See Also
predRisk
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  # specify dataset with outcome and predictor variables
data(ExampleData)
# specify column number of outcome variable
cOutcome < 2
# 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 45
riskmodel1 < ExampleModels()$riskModel1
riskmodel2 < ExampleModels()$riskModel2
# obtain predicted risks
predRisk1 < predRisk(riskmodel1)
predRisk2 < predRisk(riskmodel2)
# specify label of xaxis
xlabel < "Prior risk"
# specify label of yaxis
ylabel < "Posterior risk"
# specify title for the plot
titleplot < "Prior versus posterior risk"
# specify range of the xaxis and yaxis
rangeaxis < c(0,1)
# labels given to the groups without and with the outcome of interest
labels< c("without outcome", "with outcome")
# produce prior risks and posterior risks plot
plotPriorPosteriorRisk(data=ExampleData, priorrisk=predRisk1,
posteriorrisk=predRisk2, cOutcome=cOutcome, xlabel=xlabel, ylabel=ylabel,
rangeaxis=rangeaxis, plotAll=TRUE, plottitle=titleplot, labels=labels)
