Statistical Calculators › Correlation and Regression › Logistic Regression Sample Size (Single Binary Predictor)
← All Calculators

Correlation and Regression

Logistic Regression Sample Size (Single Binary Predictor)

Estimate the sample size needed to detect an association between a binary predictor and a binary outcome in a logistic regression model. Enter the baseline event probability, odds ratio, predictor prevalence, alpha, and desired power. The calculation uses the Hsieh, Bloch & Larsen approximation for a single binary covariate.

Study Design

Specify the expected outcome probability when X=0 and the effect to be detected for the binary predictor.

Sample Size Result

Based on the normal approximation for a logistic regression with one binary predictor.
Enter the study parameters and click Calculate Sample Size.

Methodology

This calculator treats a logistic regression with one binary predictor as the comparison of two outcome probabilities: P0 when X=0 and P1 when X=1. The odds ratio specifies the relationship between those probabilities:

P1 = OR × P0 / [1 − P0 + OR × P0]

For a binary predictor, Hsieh, Bloch, and Larsen (1998) show that the logistic-regression sample-size calculation can be obtained from the corresponding two-proportion formulation. The overall expected event probability is the prevalence-weighted average of P0 and P1.

Sample Size Formula

Let q be the proportion of subjects with X=1, so that 1−q is the proportion with X=0. Let pE be the prevalence-weighted event probability:

pE = (1 − q)P0 + qP1

The continuous sample-size estimate is:

N = [ zα √{pE(1−pE)[1/(1−q) + 1/q]} + zβ √{P0(1−P0)/(1−q) + P1(1−P1)/q} ]2 / (P1 − P0)2

For a two-sided test, zα = Φ−1(1−α/2). For a one-sided test, zα = Φ−1(1−α). In both cases, zβ = Φ−1(power).

The calculator reports the continuous estimate rounded to the nearest whole subject, matching the rounding convention used in the this method validation example. The displayed group allocation is then obtained from the specified percentage of subjects with X=1.

Worked Validation Example

the relevant methodological literature provides a validation example with a 7% baseline probability, odds ratio 1.5, 90% power, two-sided alpha 0.05, and 50% of subjects having X=1. The corresponding alternative probability is approximately 0.10145. The continuous calculation gives N = 3326.4064, which rounds to 3326 subjects. The resulting calculated power is approximately 0.89997.

P0 = 0.07
OR = 1.50
Percent X=1 = 50%
Alpha = 0.05
Power = 0.90
P1 = 0.1014493
Continuous N = 3326.4064
Reported N = 3326
X=0: 1663 subjects
X=1: 1663 subjects
Calculated power = 0.89997

Interpretation

This procedure is appropriate when the primary predictor of interest is binary, such as treatment versus control, exposed versus unexposed, or presence versus absence of a characteristic. The odds ratio is the multiplicative change in the odds of Y=1 associated with X changing from 0 to 1.

The calculation assumes a simple logistic regression containing the binary predictor of interest. If additional covariates are included and are correlated with the predictor of interest, the required sample size can increase. this method provides a separate procedure that incorporates the R-squared between the predictor of interest and other covariates.

References

Hsieh, F.Y., Bloch, D.A., & Larsen, M.D. (1998). A simple method of sample size calculation for linear and logistic regression. Statistics in Medicine, 17(14), 1623–1634. DOI: 10.1002/(SICI)1097-0258(19980730)17:14<1623::AID-SIM871>3.0.CO;2-S.

Hsieh, F.Y. (1989). Sample size tables for logistic regression. Statistics in Medicine, 8(7), 795–802. DOI: 10.1002/sim.4780080704.

the software, LLC. this method Sample Size Software Documentation: Logistic Regression (Legacy), Example 4 — Sample Size for a Binary Covariate. the relevant methodological literature.

Advisor documentation, Regression Tables, ROT9: Logistic Regression for Binary Covariate. The documentation identifies Hsieh (1989) as the source for the normal-approximation formulas used for the single binary-covariate procedure.