plotRiskscorePredrisk {PredictABEL} | R Documentation |
Function to plot predicted risks against risk scores.
Description
This function is used to make a plot of predicted risks against risk scores.
Usage
plotRiskscorePredrisk(data, riskScore, predRisk, plottitle, xlabel,
ylabel, rangexaxis, rangeyaxis, filename, fileplot, plottype)
Arguments
data |
Data frame or matrix that includes the outcome and predictors variables. |
riskScore |
Vector of (weighted or unweighted) genetic risk scores. |
predRisk |
Vector of predicted risks. |
plottitle |
Title of the plot. Specification of |
xlabel |
Label of x-axis. Specification of |
ylabel |
Label of y-axis. Specification of |
rangexaxis |
Range of the x axis. Specification of |
rangeyaxis |
Range of the y axis. Specification of |
filename |
Name of the output file in which risk scores and
predicted risks for each individual 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 predicted risks against risk scores.
Predicted risks can be obtained using the functions
fitLogRegModel
and predRisk
or be imported from other methods or packages.
The function riskScore
can be
used to compute unweighted or weighted risk scores.
Value
The function creates a plot of predicted risks against risk scores.
See Also
Examples
# specify dataset with outcome and predictor variables
data(ExampleData)
# 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 column numbers of genetic predictors
cGenPred <- c(11:16)
# function to compute unweighted genetic risk scores
riskScore <- riskScore(weights=riskmodel, data=ExampleData,
cGenPreds=cGenPred, Type="unweighted")
# specify range of x-axis
rangexaxis <- c(0,12)
# specify range of y-axis
rangeyaxis <- c(0,1)
# specify label of x-axis
xlabel <- "Risk score"
# specify label of y-axis
ylabel <- "Predicted risk"
# specify title for the plot
plottitle <- "Risk score versus predicted risk"
# produce risk score-predicted risk plot
plotRiskscorePredrisk(data=ExampleData, riskScore=riskScore, predRisk=predRisk,
plottitle=plottitle, xlabel=xlabel, ylabel=ylabel, rangexaxis=rangexaxis,
rangeyaxis=rangeyaxis)