beta0: Calculate the intercept of a logistic regression model, given...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/beta0.q

Description

When conducting power calculations, one is often interested in examining power for various 'effect sizes'. Suppose the logistic regression is specified via the vector of coefficients (beta0, betaX); the first element is the intercept and the second consists of a vector of log odds ratio parameters. In many settings, the overall outcome prevalence in the population of interest is known or, at least, fixed. Modifying any given element of betaX will automatically modify the overall prevalence, unless there is a corresponding change in beta0. The function beta0() calculates the value of beta0 that minimizes the difference between the target outcome prevalence, rhoY, and prevalence induced by the model in conjuction with the assumed marginal exposure distribution.

Usage

1
beta0(betaX, X, N, rhoY, expandX="all")

Arguments

betaX

Numeric vector of log-odds ratio parameters for the logistic regression model.

X

Design matrix for the logistic regression model. The first column should correspond to intercept. For each exposure, the baseline group should be coded as 0, the first level as 1, and so on.

N

A numeric vector providing the sample size for each row of the design matrix, X.

rhoY

Target outcome prevalence in the population.

expandX

Character vector indicating which columns of X to expand as a series of dummy variables. Useful when at least one exposure is continuous (and should not be expanded). Default is ‘all’; the other option is ‘none’ or character vector of column names.

Details

The minimization is performed using the optimize function.

Value

Numeric value of the intercept parameter in a logistic regression model.

Author(s)

Sebastien Haneuse, Takumi Saegusa

References

Haneuse, S. and Saegusa, T. and Lumley, T. (2011) "osDesign: An R Package for the Analysis, Evaluation, and Design of Two-Phase and Case-Control Studies." Journal of Statistical Software, 43(11), 1-29.

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
##
data(Ohio)

## 
XM   <- cbind(Int=1, Ohio[,1:3])
fitM <- glm(cbind(Death, N-Death) ~ factor(Age) + Sex + Race, data=Ohio,
            family=binomial)

## Overall prevalence in the observed data
##
sum(Ohio$Death)/sum(Ohio$N)

## Intercept corresponding to the original vector of log-odds ratios
## 
fitM$coef
beta0(betaX=fitM$coef[-1], X=XM, N=Ohio$N, rhoY=sum(Ohio$Death)/sum(Ohio$N))

## Reduction of Sex effect by 50%
##
betaXm    <- fitM$coef[-1]
betaXm[3] <- betaXm[3] * 0.5
beta0(betaX=betaXm, X=XM, N=Ohio$N, rhoY=sum(Ohio$Death)/sum(Ohio$N))

## Doubling of Race effect
##
betaXm    <- fitM$coef[-1]
betaXm[4] <- betaXm[4] * 2
beta0(betaX=betaXm, X=XM, N=Ohio$N, rhoY=sum(Ohio$Death)/sum(Ohio$N))

Example output

[1] 0.002492144
 (Intercept) factor(Age)1 factor(Age)2          Sex         Race 
  -5.9620986    0.5953782    0.6879627   -1.0041234    0.2830300 
[1] -5.962099
[1] -6.155521
[1] -5.998714

osDesign documentation built on Nov. 16, 2020, 9:09 a.m.

Related to beta0 in osDesign...