Skip to main content

    Method document

    Sample size to estimate a hazard ratio

    How many participants are needed in each of two groups to estimate a hazard ratio from a Cox model within a chosen factor, from the survival expected at the end of follow-up; or in several groups, each against a reference. Covers unequal groups and non-response.

    Engine version 1.0.0 · Reviewed 9 October 2026

    https://statwisely.com/methods/precision-hazard-ratio/

    When to use it

    • A cohort or trial whose aim is to report how much an exposure or treatment changes the hazard of an event, with its interval.

    Not for

    • Showing that the hazard ratio differs from 1. Use the log-rank test under “Detect an effect”.

    Notation

    n1, n2n_1,\ n_2
    Participants in groups 1 and 2 (group 2 is the reference)
    SS
    Survival in the reference group at the end of follow-up
    HR\mathrm{HR}
    Expected hazard ratio, group 1 against group 2; 1 if not given
    rar_a
    Allocation ratio n₂ / n₁
    π1, π2\pi_1,\ \pi_2
    Shares of participants, 1/(1 + r_a) and r_a/(1 + r_a)
    II
    Expected Cox information about the log hazard ratio, per participant
    ff
    Precision factor: the interval runs from HR / f to HR × f
    gg
    Number of groups, including the reference
    z1−α/2z_{1-\alpha/2}
    Standard normal quantile for confidence 1 − α (1.960 for 95%)
    qq
    Non-response rate

    Formulas

    Participants from the Cox information

    n1=⌈z1−α/22(1+ra) I (ln⁡f)2⌉,n2=⌈ra n1⌉n_1 = \left\lceil \frac{z_{1-\alpha/2}^{2}}{(1 + r_a)\, I\, (\ln f)^{2}} \right\rceil, \qquad n_2 = \lceil r_a\, n_1 \rceil

    Each event contributes the variance of the covariate among those still at risk, weighted by their hazard; I integrates that over follow-up, with exponential survival censored at its end. At a hazard ratio of 1 it is Var(x) times the share with an event: Schoenfeld’s π₁π₂ for two groups [1] and 1 per SD [2]. With unbalanced events, a real effect leaves less than Schoenfeld’s form: close to d₁d₂/(d₁ + d₂) of each group’s events.

    Several groups against a reference

    n1=⌈z1−α/22 max⁡j[I−1]jj(g−1+ra) (ln⁡f)2⌉,α  ←  α/(g−1) (simultaneous)n_1 = \left\lceil \frac{z_{1-\alpha/2}^{2}\, \max_j \left[I^{-1}\right]_{jj}}{(g - 1 + r_a)\, (\ln f)^{2}} \right\rceil, \qquad \alpha \;\leftarrow\; \alpha / (g-1) \ \text{(simultaneous)}

    Optional. With g groups, each of the g − 1 others is compared with the same reference group of r_a n₁. I is then the information matrix about the g − 1 log hazard ratios, and the comparison with the largest variance sets the common size. Choosing simultaneous intervals splits α across the comparisons (Bonferroni).

    Non-response

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

    The number to approach in each group so that n respond. Applied last, after any clustering.

    Parameters

    Confidence level1−α1-\alpha

    Values: 90%, 95% or 99%

    95% is the convention in health research. A higher level widens the interval, so the same margin needs a larger sample.

    Precision factorff

    Values: Above 1; 1.5 means the interval runs from HR / 1.5 to HR × 1.5

    A rare event leaves few events to learn from, so it needs many participants for any factor.

    Survival in the reference group at the end of follow-upSS

    Values: Between 0 and 1

    From routine data or earlier studies of the reference group.

    Expected hazard ratioHR\mathrm{HR}Optional

    Values: Above 0; 1 if left blank

    It sets how many events group 1 has, and so the information.

    Allocation ratiora=n2/n1r_a = n_2/n_1Optional

    Values: Above 0; 1 for equal groups

    The planned size of group 2 divided by group 1. Equal groups give the most precision for a given total; use another ratio when one group is easier or cheaper to recruit.

    Number of groups, including the referenceggOptional

    Values: A whole number of at least 2; 2 for one comparison

    For example, two treatments against a control is g = 3.

    Expected hazard ratio of each group against the referenceHRj\mathrm{HR}_jOptional

    Values: g − 1 values above 0; 1 each if left blank

    They set how many events each group has.

    Simultaneous intervals across comparisonsα/(g−1)\alpha / (g-1)Optional

    Values: On or off

    Turn on when the comparisons will be read together.

    Expected non-response rateqqOptional

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

    The share of people approached who will not take part; use the response rate of a comparable study. Approaching more people restores the number of respondents, not their representativeness: if non-responders differ, the estimate can still be biased.

    Assumptions

    • Hazards are proportional; survival is exponential and censored only at the end of a common follow-up period.
    • Non-response is unrelated to the outcome.

    Worked examples

    Two equal groups

    0.6 event-free at the end of follow-up, factor 1.5: 40% have an event, so I = 0.25 × 0.40 = 0.10 and n₁ = 1.96² / (2 × 0.10 × (ln 1.5)²) = 116.8, rounded up to 117 per group.

    Group 1: 117 · Group 2: 117 · Total: 234

    Open this example in the calculator

    A lower hazard in a smaller group

    Expecting HR = 0.7 with twice as many in group 2: I = 0.0728, below Schoenfeld’s 0.0815, so 107 and 214.

    Group 1: 107 · Group 2: 214 · Total: 321

    Open this example in the calculator

    Two treatments against a control

    Hazard ratios of 0.8 and 0.65 against a control with 0.6 event-free, factor 1.5, read together: 185 in each of the 3 groups.

    185 per group · Total: 555

    Open this example in the calculator

    A rarer event

    With 0.9 event-free, only 10% have an event: 468 per group.

    Group 1: 468 · Group 2: 468 · Total: 936

    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.
    • The basic result agrees with Schoenfeld’s form: 4 × 1.96² / (ln 1.5)² = 93.5 events, at 40% with an event. Cox models fitted to simulated samples at the planned sizes gave median interval factors within 0.2% of the target and coverage of 94% to 96%. An independent implementation in R recomputes these sizes and is compared with the engine’s.

    How to cite

    StatWisely. Sample size to estimate a hazard ratio. Method document, engine version 1.0.0, reviewed 2026-10-09. https://statwisely.com/methods/precision-hazard-ratio/

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

    References

    1. 1.Schoenfeld DA. Sample-size formula for the proportional-hazards regression model. Biometrics. 1983;39(2):499–503.
    2. 2.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.