Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/powerLogisticsReg.R
Calculating power for simple logistic regression with binary predictor.
1 2 3 4 5  powerLogisticBin(n,
p1,
p2,
B,
alpha = 0.05)

n 
total number of sample size. 
p1 
pr(diseasedX=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(diseasedX=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. 
The logistic regression mode is
\log(p/(1p)) = β_0 + β_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 β_1=0, is Formula (2) in Hsieh et al. (1998):
n=(Z_{1α/2}[p(1p)/B]^{1/2} + Z_{power}[p_1(1p_1)+p_2(1p_2)(1B)/B]^{1/2})^2/[ (p_1p_2)^2 (1B) ]
where n is the required total sample size and Z_u is the uth percentile of the standard normal distribution.
Estimated power.
The test is a twosided test. For onesided tests, please double the
significance level. For example, you can set alpha=0.10
to obtain onesided test at 5% significance level.
Weiliang Qiu stwxq@channing.harvard.edu
Hsieh, FY, Bloch, DA, and Larsen, MD. A SIMPLE METHOD OF SAMPLE SIZE CALCULATION FOR LINEAR AND LOGISTIC REGRESSION. Statistics in Medicine. 1998; 17:16231634.
1 2 3 4  ## Example in Table I Design (Balanced design with high event rates)
## of Hsieh et al. (1998 )
## the power = 0.95
powerLogisticBin(n = 1281, p1 = 0.4, p2 = 0.5, B = 0.5, alpha = 0.05)

[1] 0.9500671
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.