Function to fit a logistic regression model.

Share:

Description

The function fits a standard GLM function for the logistic regression model.

Usage

1
2
fitLogRegModel(data, cOutcome, cNonGenPreds, cNonGenPredsCat, 
cGenPreds, cGenPredsCat)

Arguments

data

Data frame or matrix that includes the outcome and predictor variables.

cOutcome

Column number of the outcome variable. cOutcome=2 means that the second column of the dataset is the outcome variable. To fit the logistic regression model, the outcome variable needs to be (re)coded as 1 for the presence and 0 for the absence of the outcome of interest.

cNonGenPreds

Column numbers of the non-genetic predictors that are included in the model. An example to denote column numbers is c(3,6:8,10). Choose c(0) when no non-genetic predictors are considered.

cNonGenPredsCat

Column numbers of the non-genetic predictors that are entered as categorical variables in the model. When non-genetic predictors are not specified as being categorical they are treated as continuous variables in the model. If no non-genetic predictors are categorical, denote c(0).

cGenPreds

Column numbers of the genetic predictors or genetic risk score. Denote c(0) when the prediction model does not consider genetic predictors or genetic risk score.

cGenPredsCat

Column numbers of the genetic predictors that are entered as categorical variables in the model. When SNPs are considered as categorical, the model will estimate effects per genotype. Otherwise, SNPs are considered as continuous variables for which the model will estimate an allelic effect. Choose c(0) when no genetic predictors are considered as categorical or when genetic predictors are entered as a risk score into the model.

Details

The function fits a standard GLM function for the logistic regression model. This function can be used to construct a logistic regression model based on genetic and non-genetic predictors. The function also allows to enter the genetic predictors as a single risk score. For that purpose, the function requires that the dataset additionally includes the risk score. A new dataset can be constructed using "NewExampleData <- cbind(ExampleData,riskScore)". The genetic risk scores can be obtained using the function riskScore in this package or be imported from other methods.

Value

No value returned.

See Also

predRisk, ORmultivariate, riskScore

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# specify dataset with outcome and predictor variables 
data(ExampleData)
# specify column number of outcome variable
cOutcome <- 2 
# 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)

# show summary details for the fitted risk model
summary(riskmodel)