Skip to main content

    Method document

    Sample size for a Cox regression with a numerical predictor

    How many participants, and so events, are needed to show that a numerical predictor, such as a biomarker or age, is associated with survival in a Cox model, from its hazard ratio per standard deviation and the survival expected at its mean. Allows for other covariates. Covers accrual and follow-up, losses to follow-up and dropout.

    Engine version 1.0.0 · Reviewed 9 October 2026

    https://statwisely.com/methods/survival-cox-continuous/

    When to use it

    • A prognostic or aetiological cohort testing whether a measured factor changes the hazard of death, relapse or another event.

    Not for

    • A binary predictor or two randomised groups. Use the log-rank test or Cox regression with a binary predictor.

    Notation

    NN
    Number of participants
    DD
    Expected number of events, N P_E
    HR\mathrm{HR}
    Hazard ratio per SD of the predictor; β = ln HR
    S0S_0
    Survival at the end of the study for someone at the predictor’s mean
    PEP_E
    Share of participants expected to have the event, averaged over the predictor
    I(β)I(\beta)
    Expected Cox information about β per participant
    RX∣Z2R^{2}_{X|Z}
    Share of the predictor’s variance explained by the other covariates
    a, fa,\ f
    Accrual period and additional follow-up after it
    η\eta
    Loss-to-follow-up hazard
    c, μc,\ \mu
    Chance of a competing event by the end of the study, and its hazard
    α\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

    Participants from the Cox information

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

    The Wald test of the slope of a standard-normal predictor [1]. Each event contributes the variance of the predictor among those still at risk, weighted by their hazard; I(β) integrates that over follow-up, with exponential survival and censoring at the end of the study. With no effect it equals P_E, which is Hsieh and Lavori’s D = (z₁₋α/₂ + z₁₋β)² / [(ln HR)²(1 − R²)] events; a real effect leaves slightly less.

    Expected events

    D=N PE,PE=Ex ⁣[1−S0HRx]D = N\,P_E, \qquad P_E = E_x\!\left[1 - S_0^{\mathrm{HR}^{x}}\right]

    Averaged over the predictor by quadrature. With accrual and follow-up times, the exponential hazard implied by S₀ is averaged over uniform entry, with any losses, as in the log-rank calculation [2].

    Competing risks

    μ=−ln⁡(1−c)H,η  ←  η+μ\mu = \frac{-\ln(1 - c)}{H}, \qquad \eta \;\leftarrow\; \eta + \mu

    Optional. A competing event ends follow-up for the event of interest, so for a cause-specific hazard ratio it acts as one more censoring hazard μ over the study horizon H (the accrual plus follow-up, or one study period). The events of interest needed are unchanged; fewer participants have one, so more are needed [3]. A subdistribution (Fine–Gray) hazard ratio is a different estimand.

    Dropout

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

    Applied last, to the participants actually recruited.

    Parameters

    Hazard ratio per SDHR\mathrm{HR}

    Values: Above 0 and not 1

    The smallest change in hazard per standard deviation of the predictor worth detecting.

    Survival at the predictor’s meanS0S_0

    Values: Between 0 and 1

    The share expected to be event-free at the end of the study for someone at the average value of the predictor.

    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.

    Accrual periodaaOptional

    Values: 0 or more, with the follow-up

    How long recruitment lasts; entry is taken as uniform over it.

    Follow-up after accrualffOptional

    Values: 0 or more, with the accrual

    How long the study continues after the last participant joins.

    Loss-to-follow-up rateη\etaOptional

    Values: 0 or more, per unit of time; needs accrual and follow-up

    Participants lost cannot have the event, so they lower the expected events.

    Chance of a competing eventccOptional

    Values: At least 0 and below 1; 0 by default

    The share expected to have an event that ends follow-up for the event of interest by the end of the study, such as death from another cause.

    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

    • Hazards are proportional and change log-linearly with a roughly normal predictor; survival is exponential, censored at the end of the study and by any stated losses.
    • Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.

    Worked examples

    A biomarker, 30% with an event

    HR = 1.3 per SD with 0.7 event-free at the mean: 30.5% have an event, I(β) = 0.3017, so N = (2.80)² / ((ln 1.3)² × 0.3017) = 377.99, rounded up to 378, with 116 events expected.

    Events: 116 · Sample size: 378

    Protocol statement

    To detect a hazard ratio of 1.3 per standard deviation with 80% power at a two-sided significance level of 0.05, using a Cox regression on a numerical predictor, and assuming 70% event-free at the end of the study at the predictor’s mean, 116 events are required; with an expected event probability of 30.54%, the required sample size is 378 participants. Calculated with StatWisely (statwisely.com) using: N = [z_(1-α/2)+z_(1-β)]²/[(ln HR)²·I(β)·(1-R²_X|Z)], I(β) the Cox information per participant. 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: 377.99 / 0.7 = 539.99, so N = 540.

    Events: 165 · Sample size: 540

    Open this example in the calculator

    Recruitment over two years

    HR = 0.8 per SD, 0.5 event-free at the mean over the study, recruitment over 2 years and 3 more of follow-up, losses at 0.05 a year: N = 409, with 160 events.

    Events: 160 · Sample size: 409

    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.
    • At no effect the information equals the share with an event, Hsieh and Lavori’s form. Cox models fitted to simulated samples at the planned sizes, with and without uniform entry and losses, gave power of 0.79 to 0.80 against a target of 0.80, and the expected events matched to within 1.

    How to cite

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

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

    References

    1. 1.Hsieh FY, Lavori PW. Sample-size calculations for the Cox proportional hazards regression model with nonbinary covariates. Controlled Clinical Trials. 2000;21(6):552–560.
    2. 2.Lachin JM, Foulkes MA. Evaluation of sample size and power for analyses of survival with allowance for nonuniform patient entry, losses to follow-up, noncompliance, and stratification. Biometrics. 1986;42(3):507–519.
    3. 3.Pintilie M. Dealing with competing risks: testing covariates and calculating sample size. Statistics in Medicine. 2002;21(22):3317–3324.