Calculate the intercept of a logistic regression model, given a vector of log-odds ratio parameters and an overall prevalence.
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 (
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.
beta0(betaX, X, N, rhoY, expandX="all")
Numeric vector of log-odds ratio parameters for the logistic regression model.
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.
A numeric vector providing the sample size for each row of the design matrix,
Target outcome prevalence in the population.
Character vector indicating which columns of
The minimization is performed using the
Numeric value of the intercept parameter in a logistic regression model.
Sebastien Haneuse, Takumi Saegusa
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.
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 <- betaXm * 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 <- betaXm * 2 beta0(betaX=betaXm, X=XM, N=Ohio$N, rhoY=sum(Ohio$Death)/sum(Ohio$N))