Skip to main content

    Method document

    Sample size to estimate a hazard ratio per step across ordered groups

    How many participants are needed in each of three or more ordered groups to estimate the hazard ratio per step from a Cox model on the group scores, within a chosen factor. Covers non-response.

    Engine version 1.0.0 · Reviewed 10 October 2026

    https://statwisely.com/methods/precision-hr-trend/

    When to use it

    • A dose–response or exposure-gradient estimate for survival, reported as a hazard ratio per category step.

    Not for

    • Showing that a trend exists. Use the log-rank test for trend under “Detect an effect”.

    Notation

    nn
    Participants in each group
    gg
    Number of ordered groups
    S1S_1
    Survival in the first group at the end of follow-up
    II
    Expected Cox information about the log hazard ratio per step, per participant
    ff
    Precision factor: the interval runs from HR / f to HR × f
    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

    n=⌈z1−α/22g I (ln⁡f)2⌉n = \left\lceil \frac{z_{1-\alpha/2}^{2}}{g\, I\, (\ln f)^{2}} \right\rceil

    Each event contributes the hazard-weighted variance of the group scores among those still at risk; I integrates that over follow-up, with exponential survival censored at its end [1]. At no effect it is the share with an event times the scores’ variance.

    Non-response

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

    The number to approach 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.25 means the interval runs from HR / 1.25 to HR × 1.25.

    Survival in the first groupS1S_1

    Values: Between 0 and 1

    At the end of follow-up.

    Number of ordered groupsgg

    Values: At least 3

    Each is planned the same size.

    Expected hazard ratio per stepHR\mathrm{HR}Optional

    Values: Above 0; 1 if left blank

    It sets how many events each group has.

    Group scoressjs_jOptional

    Values: One per group; 0, 1, 2, … by default

    The hazard ratio is per unit of score.

    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 and log-linear in the scores; survival is exponential and censored only at the end of a common follow-up.
    • Non-response is unrelated to the outcome.

    Worked examples

    Three groups, no effect assumed

    0.6 event-free, factor 1.25: I = 0.4 × 2/3 = 0.267, so n = 1.96² / (3 × 0.267 × (ln 1.25)²) = 96.4, rounded up to 97 per group.

    97 per group · Total: 291

    Open this example in the calculator

    A falling hazard

    Expecting 0.8 per step, the later groups have fewer events: I = 0.221 and 117 per group.

    117 per group · Total: 351

    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.
    • Cox models on the scores, fitted to simulated samples at the planned sizes, gave median interval factors of 1.2497 against a target of 1.25. 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 per step across ordered groups. Method document, engine version 1.0.0, reviewed 2026-10-10. https://statwisely.com/methods/precision-hr-trend/

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

    References

    1. 1.Collett D. Modelling Survival Data in Medical Research. 3rd ed. Boca Raton: CRC Press; 2015.