Skip to main content

    Method document

    Sample size for logistic regression with a numerical predictor

    How many participants are needed to show that a numerical predictor is associated with a binary outcome in a logistic regression, from the odds ratio per standard deviation of the predictor and the outcome probability at its mean. Allows for other covariates. Covers dropout.

    Engine version 1.0.0 · Reviewed 4 October 2026

    https://statwisely.com/methods/regression-logistic-continuous/

    When to use it

    • A cohort or cross-sectional study analysed with logistic regression, testing whether a measured predictor such as age or a biomarker is associated with a yes/no outcome.

    Not for

    • A binary predictor. Use logistic regression with a binary predictor.
    • A strongly skewed predictor, or one with only a few distinct values. The formula assumes a normal distribution; transform the predictor or check the size by simulation.
    • Developing a prediction model. That needs its own sample-size criteria, not the power of one coefficient.

    Notation

    NN
    Number of participants
    pp
    Outcome probability at the mean of the predictor
    OR\mathrm{OR}
    Odds ratio for a one-standard-deviation increase in the predictor
    RX∣Z2R^{2}_{X|Z}
    Share of the predictor’s variance explained by the other covariates
    α\alpha
    Significance level: the chance of a false positive
    1−β1-\beta
    Power: the chance of detecting the effect if it is real
    qq
    Expected dropout

    Formulas

    Hsieh’s formula for a normally distributed predictor

    N=⌈(z1−α/2+z1−β)2p(1−p) (ln⁡OR)2⋅11−RX∣Z2⌉N = \left\lceil \frac{(z_{1-\alpha/2} + z_{1-\beta})^{2}}{p(1-p)\,(\ln \mathrm{OR})^{2}} \cdot \frac{1}{1 - R^{2}_{X|Z}} \right\rceil

    Powers the Wald test of the logistic coefficient for a standardized, normally distributed predictor [1]. The last factor inflates the sample for other covariates, according to how well they predict this one.

    From an odds ratio per unit

    OR=ORunit σX\mathrm{OR} = \mathrm{OR}_{\text{unit}}^{\,\sigma_X}

    An odds ratio reported per unit of the predictor becomes one per standard deviation σ_X by raising it to that power.

    Dropout

    nrecruit=⌈n1−q⌉n_{\text{recruit}} = \left\lceil \frac{n}{1 - q} \right\rceil

    Applied last, to the participants actually recruited.

    Parameters

    Odds ratio per standard deviationOR\mathrm{OR}

    Values: Above 0, not 1

    The smallest change in odds, for a one-SD rise in the predictor, worth detecting. An odds ratio and its reciprocal need the same sample.

    Outcome probability at the predictor’s meanpp

    Values: Between 0 and 1

    For someone with an average value of the predictor. With a rare outcome, the overall event rate is a close substitute.

    R² of the predictor on the other covariatesRX∣Z2R^{2}_{X|Z}Optional

    Values: At least 0 and below 1; 0 with no other covariates

    How well the other covariates predict this one. Strongly related covariates cost power.

    Predictor tested11

    Values: One numerical predictor

    Other covariates enter only through R²_X|Z.

    Significance levelα\alpha

    Values: Between 0 and 1; usually 0.05

    The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.

    Power1−β1-\beta

    Values: Between 0 and 1; usually 0.80 or 0.90

    The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.

    Expected dropoutqqOptional

    Values: 0% up to, but not including, 100%

    The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.

    Assumptions

    • Participants are independent, and the predictor is approximately normally distributed.
    • The log odds change linearly with the predictor.
    • The test is the Wald test of the coefficient, two-sided.
    • Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.

    Worked examples

    An odds ratio of 1.5 per SD

    OR = 1.5 per SD with an outcome probability of 0.5 at the mean, at 95% power: (1.960 + 1.645)² / (0.25 × 0.405²) = 316.2, so N = 317.

    Sample size: 317

    Protocol statement

    To detect an odds ratio of 1.5 per standard deviation of the predictor with 95% power at a two-sided significance level of 0.05, using a logistic regression with a normally distributed numerical predictor, and assuming an outcome probability of 50% at the predictor's mean, the required sample size is 317 participants. Calculated with StatWisely (statwisely.com) using: Hsieh normal covariate: N=(z_(1-α/2)+z_(1-β))²/[p(1-p)(ln OR)²]/(1-R²_X|Z). These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    A less common outcome

    The same odds ratio with an outcome probability of 0.1: p(1 − p) falls from 0.25 to 0.09, so N = 879.

    Sample size: 879

    Protocol statement

    To detect an odds ratio of 1.5 per standard deviation of the predictor with 95% power at a two-sided significance level of 0.05, using a logistic regression with a normally distributed numerical predictor, and assuming an outcome probability of 10% at the predictor's mean, the required sample size is 879 participants. Calculated with StatWisely (statwisely.com) using: Hsieh normal covariate: N=(z_(1-α/2)+z_(1-β))²/[p(1-p)(ln OR)²]/(1-R²_X|Z). These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    Adjusting for related covariates

    If the other covariates explain 0.3 of the predictor’s variance: 316.2 / (1 − 0.3) = 451.7, so N = 452.

    Sample size: 452

    Protocol statement

    To detect an odds ratio of 1.5 per standard deviation of the predictor with 95% power at a two-sided significance level of 0.05, using a logistic regression with a normally distributed numerical predictor, and assuming an outcome probability of 50% at the predictor's mean and other covariates explaining 0.3 of its variance, the required sample size is 452 participants. Calculated with StatWisely (statwisely.com) using: Hsieh normal covariate: N=(z_(1-α/2)+z_(1-β))²/[p(1-p)(ln OR)²]/(1-R²_X|Z). These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    Validation

    • Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
    • An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
    • For the normal-predictor example in the G*Power manual (OR = 1.5 per SD, outcome probability 0.5 at the mean, α = 0.05, 95% power), StatWisely gives the published 317, which replicates Table II of Hsieh et al. [2, 1].

    How to cite

    StatWisely. Sample size for logistic regression with a numerical predictor. Method document, engine version 1.0.0, reviewed 2026-10-04. https://statwisely.com/methods/regression-logistic-continuous/

    Cite the original references for the formulas your design uses as well.

    References

    1. 1.Hsieh FY, Bloch DA, Larsen MD. A simple method of sample size calculation for linear and logistic regression. Statistics in Medicine. 1998;17(14):1623–1634.
    2. 2.Faul F, Erdfelder E, Lang AG, Buchner A. G*Power 3: a flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods. 2007;39(2):175–191.