Skip to main content

    Method document

    Sample size to estimate an odds ratio

    How many participants are needed in each of two groups to estimate an odds ratio within a chosen factor: an interval that runs from the estimate divided by that factor to the estimate multiplied by it. Covers case-control and cohort designs, unequal groups, finite populations, cluster sampling and non-response.

    Engine version 1.0.0 · Reviewed 1 October 2026

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

    When to use it

    • A case-control study whose aim is to estimate the odds ratio for an exposure with a stated precision.
    • A cohort or cross-sectional study reporting an odds ratio, when precision rather than a test is the objective.

    Not for

    • Showing that the odds ratio differs from 1. Use the powered odds-ratio calculation under “Detect an effect”.
    • Matched case-control studies, and odds ratios adjusted for other variables, which need methods for conditional or regression estimates.

    Notation

    n1, n2n_1,\ n_2
    Sample sizes of groups 1 and 2 (cases and controls in a case-control study)
    p1, p2p_1,\ p_2
    Expected proportion with the characteristic in each group: exposure among cases and controls, or the outcome among exposed and unexposed
    rar_a
    Allocation ratio n₂ / n₁
    ff
    Precision factor: the interval runs from OR / f to OR × f
    aj, bja_j,\ b_j
    Share of exposure category j among cases and among controls, j = 0 the reference
    z1−α/2z_{1-\alpha/2}
    Standard normal quantile for confidence 1 − α (1.960 for 95%)
    N1, N2N_1,\ N_2
    Population sizes of the two groups
    DE\mathrm{DE}
    Design effect
    ρ\rho
    Intracluster correlation coefficient (ICC)
    mm
    Usable observations per cluster
    kk
    Number of clusters in each group
    CV\mathrm{CV}
    Coefficient of variation of cluster size
    L, UL,\ U
    Low and high ends of the range of cluster values
    qq
    Non-response rate

    Formulas

    Simple random sampling

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

    An odds ratio is estimated on the log scale, where its interval is symmetric, so a margin of ln f there becomes a factor f on the ratio scale. The bracket is Woolf’s large-sample variance of the log odds ratio, per participant [1].

    An exposure in several categories

    n1=⌈z1−α/22 max⁡j[1aj+1a0+1ra(1bj+1b0)](ln⁡f)2⌉n_1 = \left\lceil \frac{z_{1-\alpha/2}^{2}\,\max_{j}\left[\dfrac{1}{a_j} + \dfrac{1}{a_0} + \dfrac{1}{r_a}\left(\dfrac{1}{b_j} + \dfrac{1}{b_0}\right)\right]}{(\ln f)^{2}} \right\rceil

    Optional. With an exposure of three or more categories, each category is compared with the reference category 0, and the bracket is Woolf’s variance for that comparison [1]. The category needing the most cases sets the size. Simultaneous intervals split α across the comparisons. Cluster sampling is not offered with several categories.

    Finite population correction

    ni′=⌈ni1+(ni−1)/Ni⌉,i=1,2n_i' = \left\lceil \frac{n_i}{1 + (n_i - 1)/N_i} \right\rceil, \qquad i = 1, 2

    Applied to each group against its own population when population sizes are given [2]. It matters only when a group is a sizeable share of its population, and is not offered with cluster sampling.

    Design effect from an ICC

    DE=1+(m−1) ρ\mathrm{DE} = 1 + (m - 1)\,\rho

    For clusters of equal size [3]. A design effect can also be entered directly, in which case no ICC is used.

    Unequal cluster sizes

    DE=1+[(CV2+1) m−1]ρ,CV=SD⁡(sj)sˉ\mathrm{DE} = 1 + \left[(\mathrm{CV}^{2} + 1)\,m - 1\right]\rho, \qquad \mathrm{CV} = \frac{\operatorname{SD}(s_j)}{\bar{s}}

    When each cluster is given its own share s_j of the sample, the CV of those shares enlarges the design effect [4]. With a design effect entered directly the shares only divide the sample, since a measured design effect already reflects its survey’s cluster sizes.

    Number of clusters for a chosen cluster size

    k=max⁡ ⁣(2, ⌈n⋅DEm⌉),nclustered=k mk = \max\!\left(2,\ \left\lceil \frac{n \cdot \mathrm{DE}}{m} \right\rceil\right), \qquad n_{\text{clustered}} = k\,m

    Applied to each group separately, with distinct clusters in each. The requirement is rounded up to whole clusters, so the total can exceed n × DE slightly, and rounding can shift the allocation ratio a little.

    Cluster size for a fixed number of clusters

    m=⌈n (1−ρ)k−n ρ⌉,k>n ρm = \left\lceil \frac{n\,(1-\rho)}{k - n\,\rho} \right\rceil, \qquad k > n\,\rho

    Solving k·m = n·DE for m. Below that number of clusters no cluster size reaches the margin, because each extra person per cluster adds less and less information; the calculator reports the minimum number of clusters instead. With two groups, k clusters are taken in each.

    ICC from a range across clusters

    ρ≈[(U−L)/4]2p1 (1−p1)\rho \approx \frac{\left[(U - L)/4\right]^{2}}{p_1\,(1-p_1)}

    When no ICC is available: the range within which most clusters’ values are expected to fall is taken as about four between-cluster standard deviations, and the ICC is their share of the variance of the first group’s binary measure, p₁(1 − p₁). An elicitation aid, not a measurement. With two groups, the range describes the first group’s clusters.

    Few clusters

    n  ←  n(tk−1, 1−α/2z1−α/2)2n \;\leftarrow\; n \left(\frac{t_{k-1,\,1-\alpha/2}}{z_{1-\alpha/2}}\right)^{2}

    Optional. With few clusters the interval is built on k − 1 degrees of freedom, so the normal critical value is replaced by t. Because k depends on n, this is iterated until it settles.

    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 OR / 1.5 to OR × 1.5

    A ratio is bounded multiplicatively, so its precision is a factor rather than a difference. Values between 1.25 and 2 are common; smaller factors need much larger samples.

    Expected proportion in group 1p1p_1

    Values: Between 0 and 1

    In a case-control study, the expected exposure among cases; in a cohort, the expected outcome among the exposed.

    Expected proportion in group 2p2p_2

    Values: Between 0 and 1

    In a case-control study, the exposure among controls, often known from population surveys; in a cohort, the outcome among the unexposed.

    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.

    Exposure distribution among cases, reference firsta0,…,ag−1a_0, \dots, a_{g-1}Optional

    Values: Three or more shares, each above 0, adding to 1; with exposure_controls

    Replaces p₁ and p₂ when the exposure has several categories.

    Exposure distribution among controls, reference firstb0,…,bg−1b_0, \dots, b_{g-1}Optional

    Values: The same number of shares, adding to 1

    Often known from population surveys.

    Population sizesN1, N2N_1,\ N_2Optional

    Values: Whole numbers of at least 2; leave the second empty if both groups come from populations of the same size

    Leave empty for large populations. They matter only when a group would be more than about 5% of its population. Not available with cluster sampling.

    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.

    Intracluster correlation (ICC)ρ\rhoOptional

    Values: From 0 to 1

    The share of the outcome’s variation that lies between clusters. Published ICCs for health outcomes in primary-care and community clusters are mostly small, often below 0.05 [6], but depend on the outcome and the kind of cluster; prefer an estimate from a comparable study.

    Range of values across clustersL, UL,\ UOptional

    Values: Two values in the outcome’s units, the first below the second

    An alternative to the ICC: the range within which you expect most clusters’ values to fall. It is converted to an ICC by the formula above.

    Design effectDE\mathrm{DE}Optional

    Values: Above 0; usually between 1 and 3

    An alternative to the ICC, when a previous study of the same design reports its design effect.

    Observations per clustermmOptional

    Values: A whole number of at least 1

    Usable responses per cluster. Larger clusters are cheaper to reach, but when the ICC is above zero each additional person in a cluster adds less information.

    Number of clusters in each groupkkOptional

    Values: A whole number of at least 2

    Instead of a cluster size, when the clusters are fixed: the emirates of a country, the schools of a district. The calculator then finds the cluster size, or reports how many clusters the margin needs.

    Share of the sample for each clustersjs_jOptional

    Values: One positive value per cluster, on any scale

    When clusters will contribute unequally, for example in proportion to their population. With an ICC, unequal shares enlarge the design effect [4].

    Correction for few clusterstk−1t_{k-1}Optional

    Values: On or off

    Uses t on k − 1 degrees of freedom instead of the normal distribution. Worth applying when there are few clusters, roughly fewer than 30.

    Assumptions

    • The two groups are independent, unmatched samples, and participants respond independently apart from the clustering specified.
    • The odds ratio is crude (unadjusted), and every cell of the 2 × 2 table is expected to hold enough people for the large-sample variance to apply.
    • With clustering, the ICC is that of the binary measure behind the proportions (exposure in a case-control study, outcome in a cohort), the same in both groups.
    • With cluster sampling: the two groups have distinct clusters, with the same ICC and cluster size in each; clusters are of equal size unless shares are given; the sampled clusters are a small fraction of all clusters; and the analysis accounts for the clustering, for example with survey-design standard errors [3, 5].
    • Non-response is unrelated to the outcome.

    Worked examples

    Equal numbers of cases and controls

    Exposure expected in 40% of cases and 20% of controls, factor 1.5: the variance term is 1/0.24 + 1/0.16 = 10.42, and (ln 1.5)² = 0.1644, so n₁ = 1.96² × 10.42 / 0.1644 = 243.4, rounded up to 244 in each group.

    Group 1: 244 · Group 2: 244 · Total: 488

    Protocol statement

    To estimate an odds ratio with 95% confidence, to within a factor of 1.5 of the estimate, assuming expected proportions of 40% and 20% in the two groups, the required sample size is 244 participants per group, 488 in total. Calculated with StatWisely (statwisely.com) using: n₁ = z_(1-α/2)² × (1/(p₁(1-p₁)) + 1/(r·p₂(1-p₂))) / ln(f)²; n₂ = r × n₁. These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    Two controls per case

    With twice as many controls: 1/0.24 + 1/(2 × 0.16) = 7.29, so n₁ = 1.96² × 7.29 / 0.1644 = 170.4, giving 171 cases and 342 controls. Fewer cases are needed, at the cost of more participants in total.

    Group 1: 171 · Group 2: 342 · Total: 513

    Open this example in the calculator

    Cluster sampling with an ICC

    ICC 0.02 and 20 per cluster: DE = 1 + 19 × 0.02 = 1.38. Each group needs 244 × 1.38 = 336.7, so 17 clusters of 20 and 340 participants per group.

    Group 1: 340 · Group 2: 340 · Total: 680

    Protocol statement

    To estimate an odds ratio with 95% confidence, to within a factor of 1.5 of the estimate, assuming expected proportions of 40% and 20% in the two groups, 488 participants would be required under simple random sampling. Allowing for a design effect of 1.38 (ICC 0.02, 20 per cluster) for cluster sampling, the required sample size is 340 participants per group, 680 in total, in 17 clusters of 20 in each group. This assumes clusters of equal size, distinct between the two groups, with a negligible sampling fraction. Calculated with StatWisely (statwisely.com) using: n₁ = z_(1-α/2)² × (1/(p₁(1-p₁)) + 1/(r·p₂(1-p₂))) / ln(f)²; n₂ = r × n₁; clustered: n x DE, DE = 1 + (m-1)ρ. These are planning estimates; confirm the final design with a qualified statistician.

    Open this example in the calculator

    Three exposure levels against none

    Cases spread 40/35/25% and controls 60/30/10% over none, low and high exposure, factor 2: the high level needs most, 1/0.25 + 1/0.4 + 1/0.1 + 1/0.6 = 18.17, so n₁ = 3.8415 × 18.17 / (ln 2)² = 145.2, rounded up to 146 cases and 146 controls.

    Group 1: 146 · Group 2: 146 · Total: 292

    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 procedure, with and without cluster sampling, every night and before each production release, and the results are compared with the engine’s.
    • The basic result agrees with the closed form: 1.96² × 10.42 / 0.1644 = 243.4, rounded up to 244 per group. In R, ceiling(qnorm(0.975)^2 * (1/(0.4*0.6) + 1/(0.2*0.8)) / log(1.5)^2) returns 244.

    How to cite

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

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

    References

    1. 1.Woolf B. On estimating the relation between blood group and disease. Annals of Human Genetics. 1955;19(4):251–253.
    2. 2.Cochran WG. Sampling Techniques. 3rd ed. New York: John Wiley & Sons; 1977.
    3. 3.Kish L. Survey Sampling. New York: John Wiley & Sons; 1965.
    4. 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. 5.Donner A, Klar N. Design and Analysis of Cluster Randomization Trials in Health Research. London: Arnold; 2000.
    6. 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