predRisk: Function to compute predicted risks for all individuals in...

Description Usage Arguments Details Value See Also Examples

Description

Function to compute predicted risks for all individuals in the (new)dataset.

Usage

1
predRisk(riskModel, data, cID, filename)

Arguments

riskModel

Name of logistic regression model that can be fitted using the function fitLogRegModel.

data

Data frame or matrix that includes the ID number and predictor variables.

cID

Column number of ID variable. The ID number and predicted risks will be saved under filename. When cID is not specified, the output is not saved.

filename

Name of the output file in which the ID number and estimated predicted risks will be saved. The file is saved in the working directory as a txt file. Example: filename="name.txt". When no filename is specified, the output is not saved.

Details

The function computes predicted risks from a specified logistic regression model. The function fitLogRegModel can be used to construct such a model.

Value

The function returns a vector of predicted risks.

See Also

fitLogRegModel, plotCalibration, plotROC, plotPriorPosteriorRisk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# specify dataset with outcome and predictor variables
data(ExampleData)
# specify column number of the outcome variable
cOutcome <- 2
# specify column number of ID variable
cID <- 1
# specify column numbers of non-genetic predictors
cNonGenPred <- c(3:10)
# specify column numbers of non-genetic predictors that are categorical
cNonGenPredCat <- c(6:8)
# specify column numbers of genetic predictors
cGenPred <- c(11,13:16)
# specify column numbers of genetic predictors that are categorical
cGenPredCat <- c(0)

# fit logistic regression model
riskmodel <- fitLogRegModel(data=ExampleData, cOutcome=cOutcome,
cNonGenPreds=cNonGenPred, cNonGenPredsCat=cNonGenPredCat,
cGenPreds=cGenPred, cGenPredsCat=cGenPredCat)

# obtain predicted risks 
predRisk <- predRisk(riskModel=riskmodel)

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