Method document
Sample size for a trend in event rates across ordered groups
How many participants are needed in each of three or more ordered groups, such as doses or exposure levels, to show that the rate of a counted event rises or falls across them, from each group’s expected rate. Poisson or over-dispersed negative binomial counts. Covers one- or two-sided tests, clustering and dropout.
https://statwisely.com/methods/rates-trend/
When to use it
- A dose–response question for a count outcome, analysed with a trend term in Poisson or negative binomial regression.
Not for
- Groups with no natural order. Use the test across several groups.
- A response that rises and then falls, which a single trend does not describe.
Notation
- Participants in each group
- Number of groups
- Expected event rate per unit of time in group j
- Follow-up time per participant
- Negative binomial dispersion: variance μ + kμ²; 0 is Poisson
- Information per participant about group j’s log rate, 1/(1/(λⱼt) + k)
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Number of tails: 2 for a two-sided test, 1 for one-sided
- Intracluster correlation coefficient (ICC)
- Average number of participants per cluster
- Coefficient of variation of cluster size
- Clusters per group
- Expected loss of whole clusters
- Expected dropout
- Score of group j; 0, 1, 2, … unless given
- The u-weighted slope of the log rates on the scores: the log rate ratio per score unit
Formulas
Participants in each group
The Wald test of a log-linear trend, the count counterpart of the Cochran–Armitage test. When the rates are not exactly log-linear in the scores, βₛ is the trend a weighted fit would find; s̄ and θ̄ are u-weighted means [1, 2].
Clustering
When participants are recruited or randomised in clusters, observations within a cluster repeat information, and the sample is multiplied by the design effect. With equal clusters (CV = 0) this is 1 + (m − 1)ρ [3, 4].
Few clusters
Optional. A cluster trial is analysed on cluster-level summaries, so its critical values come from t on 2(C − 1) degrees of freedom rather than the normal distribution. With few clusters this costs participants; because C depends on the sample, it is iterated until it settles [5].
All adjustments together
The adjustments multiply, in this order, and the result is rounded up once. Any adjustment not used contributes a factor of 1.
Dropout
Applied last, to the participants actually recruited.
Clusters to recruit
Per group. Losing a whole cluster loses every participant in it, so an expected loss of clusters inflates the clusters recruited rather than the participants.
Parameters
Expected rate in each group, in order
Values: At least three, each above 0, not all equal
Events per participant per unit of time: the smallest pattern of differences worth detecting.
Follow-up per participant
Values: Above 0, in the rates’ time unit
Longer follow-up yields more events, and so more information, per participant.
Dispersion (negative binomial k)Optional
Values: 0 or more; 0 (the default) for Poisson counts
Clinical counts usually vary between people more than a Poisson process allows; take k from earlier data and try plausible values.
Group scoresOptional
Values: One number per group; 0, 1, 2, … by default
The value each group stands for, such as the dose. Only their spacing matters.
Significance level
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.
Power
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.
One- or two-sided
Values: 2 (two-sided) or 1 (one-sided)
Two-sided is the default. A one-sided test is justified only when an effect in the other direction would be treated exactly as no effect, and should be stated in advance.
Expected dropoutOptional
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.
Intracluster correlation (ICC)Optional
Values: From 0 to 1
For clustered designs only. Published ICCs for health outcomes in primary-care and community clusters are mostly small, often below 0.05 [6]; prefer an estimate from a comparable trial.
Average cluster sizeOptional
Values: At least 1
The average number of participants per cluster. Given with the ICC.
Variation in cluster sizeOptional
Values: 0 or more; 0 for equal clusters
The SD of cluster sizes divided by their mean. Unequal clusters cost power on their own account [4].
Expected loss of whole clustersOptional
Values: 0% up to, but not including, 100%
Clusters, such as practices or schools, expected to withdraw entirely.
Correction for few clustersOptional
Values: On or off
Worth applying when there are few clusters per group, roughly fewer than 15–20.
Assumptions
- The groups are independent and of equal size, every participant is followed for the same time, and each group’s rate is constant over it.
- Counts are Poisson, or negative binomial with the stated dispersion, the same in every group.
- The log rate changes roughly linearly with the scores.
- With clustering: clusters are independent, with the same ICC throughout, and the analysis accounts for the clustering, for example with a mixed model or cluster-level summaries [3].
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
Three doses, Poisson counts
Rates of 1, 1.25 and 1.5 a year over one year, scored 0, 1, 2: βₛ = 0.2013 (a rate ratio of 1.22 per step) and Σuⱼ(sⱼ − s̄)² = 2.433, so n = (2.80)² / (0.2013² × 2.433) = 79.6, rounded up to 80 per group.
80 per group · Total: 240
Open this example in the calculatorProtocol statement
To detect rates of 1, 1.25, 1.5 per unit of time with 80% power at a two-sided significance level of 0.05, using a test of a log-linear trend in the event rate across 3 ordered groups, and assuming follow-up of 1 per participant and group scores of 0, 1, 2, the required sample size is 80 per group (240 in total, across 3 groups). Calculated with StatWisely (statwisely.com) using: n per group = (z_(1-α/τ)+z_(1-β))²/(b²·Σuⱼ(sⱼ-s̄)²), b the weighted log-linear trend. These are planning estimates; confirm the final design with a qualified statistician.
Over-dispersed counts
With dispersion k = 0.5, Σuⱼ(sⱼ − s̄)² falls to 1.508: 128 per group.
128 per group · Total: 384
Open this example in the calculatorOne-sided
Testing only for a rise: (2.49)² / (0.2013² × 2.433) = 62.7, so 63 per group.
63 per group · Total: 189
Open this example in the calculatorUnequally spaced doses
Scoring the groups 0, 1, 3 spreads the scores but weakens the trend those rates show: 85 per group.
85 per group · Total: 255
Open this example in the calculatorValidation
- 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.
- Simulated Poisson and negative binomial counts at the planned sizes, analysed with the Wald test of a score term in generalised linear models, gave power of 0.79 to 0.83 against a target of 0.80, with the dispersion known or estimated.
How to cite
StatWisely. Sample size for a trend in event rates across ordered groups. Method document, engine version 1.0.0, reviewed 2026-10-09. https://statwisely.com/methods/rates-trend/
Cite the original references for the formulas your design uses as well.
References
- 1.Agresti A. Categorical Data Analysis. 3rd ed. Hoboken, NJ: John Wiley & Sons; 2013.
- 2.Zhu H, Lakkis H. Sample size calculation for comparing two negative binomial rates. Statistics in Medicine. 2014;33(3):376–387.
- 3.Donner A, Klar N. Design and Analysis of Cluster Randomization Trials in Health Research. London: Arnold; 2000.
- 4.Eldridge SM, Ashby D, Kerry S. Sample size for cluster randomized trials: effect of coefficient of variation of cluster size and analysis method. International Journal of Epidemiology. 2006;35(5):1292–1300. doi:10.1093/ije/dyl129
- 5.Hayes RJ, Moulton LH. Cluster Randomised Trials. 2nd ed. Boca Raton: CRC Press; 2017.
- 6.Adams G, Gulliford MC, Ukoumunne OC, Eldridge S, Chinn S, Campbell MJ. Patterns of intra-cluster correlation from primary care research to inform study design and analysis. Journal of Clinical Epidemiology. 2004;57(8):785–794. doi:10.1016/j.jclinepi.2003.12.013