Learn R Programming

powerMediation (version 0.2.3)

SSizeLogisticBin: Calculating sample size for simple logistic regression with binary predictor

Description

Calculating sample size for simple logistic regression with binary predictor.

Usage

SSizeLogisticBin(p1, 
                 p2, 
                 B, 
                 alpha = 0.05, 
                 power = 0.8)

Arguments

p1
$pr(diseased | X = 0)$, i.e. the event rate at $X = 0$ in logistic regression $logit(p) = a + b X$, where $X$ is the binary predictor.
p2
$pr(diseased | X = 1)$, the event rate at $X = 1$ in logistic regression $logit(p) = a + b X$, where $X$ is the binary predictor.
B
$pr(X = 1)$, i.e. proportion of the sample with $X = 1$
alpha
Type I error rate.
power
power for testing if the odds ratio is equal to one.

Value

  • total sample size required.

Details

The logistic regression mode is $$\log(p / (1 - p)) = \beta_0 + \beta_1 X$$ where $p = prob(Y = 1)$, $X$ is the binary predictor, $p_1 = pr(diseased | X = 0)$, $p_2 = pr(diseased| X = 1)$, $B = pr(X = 1)$, and $p = (1 - B) p_1 + B p_2$. The sample size formula we used for testing if $\beta_1 = 0$, is Formula (2) in Hsieh et al. (1998): $$n = (Z_{1-\alpha/2}[p(1-p)/B]^{1/2} + Z_{power}[p_1(1-p_1)+p_2(1-p_2)(1-B)/B]^{1/2})^2/[ (p_1-p_2)^2 (1-B) ]$$ where $n$ is the required total sample size and $Z_u$ is the $u$-th percentile of the standard normal distribution.

References

Hsieh, FY, Bloch, DA, and Larsen, MD. A SIMPLE METHOD OF SAMPLE SIZE CALCULATION FOR LINEAR AND LOGISTIC REGRESSION. Statistics in Medicine. 1998; 17:1623-1634.

See Also

powerLogisticBin

Examples

Run this code
## Example in Table I Design (Balanced design with high event rates) 
    ## of Hsieh et al. (1998 )
    ## the sample size is 1281
    SSizeLogisticBin(p1 = 0.4, p2 = 0.5, B = 0.5, alpha = 0.05, power = 0.95)

Run the code above in your browser using DataLab