Tutorials › Causal Inference › Power and Precision in Subgroup Analysis

Effect Modification and Subgroup Effects · Tutorial 866 of 972

Power and Precision in Subgroup Analysis

Use variance and power calculations to see how subgroup size, allocation, and outcome frequency shape the evidence a trial can provide about treatment-effect heterogeneity.

Advanced 11 min read

What You'll Learn

  • Define the risk-difference interaction as a difference between subgroup treatment effects
  • Calculate standard errors for subgroup effects and their interaction
  • Explain how subgroup prevalence affects the number of observations available for a contrast
  • Quantify the effect of unequal treatment allocation on precision
  • Relate binary-outcome frequencies to variance and standard error
  • Use a normal approximation to estimate sample size for a planned interaction

Why Subgroup Effects Are Harder to Estimate

A trial can estimate an overall treatment effect with useful precision while leaving substantial uncertainty about whether that effect differs across subgroups. The reason is structural: an overall contrast combines information across participants, whereas an interaction contrast compares treatment effects estimated separately in different subgroups. Each subgroup estimate is based on only part of the trial, and the interaction adds the uncertainty in those estimates.

The calculations here use a binary outcome and the risk-difference scale. They assume a randomized trial, a subgroup defined before treatment, independent participant outcomes, and complete outcome data. Randomization supports a causal interpretation of the treatment contrasts within each subgroup, provided the treatment and outcome are well-defined and the analysis targets the trial population. The precision formulas are for simple, unadjusted risk differences; covariate adjustment or clustering can change the variance.

Definition: Let \(G\) indicate membership in one of two baseline subgroups, \(g=0,1\). Let \(p_{ag}=P(Y=1\mid A=a,G=g)\) be the outcome risk under randomized treatment assignment \(a=0,1\) in subgroup \(g\). The subgroup risk difference is \(\Delta_g=p_{1g}-p_{0g}\). The additive interaction is \(\delta=\Delta_1-\Delta_0\). A nonzero \(\delta\) means the treatment risk difference differs between the two subgroups.

The interaction is a contrast between treatment effects, not a test of whether one subgroup has a statistically significant result and the other does not. Its standard error depends on the precision of both subgroup risk differences. In this tutorial, \(n_g\) denotes the total number of participants in subgroup \(g\), and \(n_{ag}\) denotes the number assigned to treatment \(a\) in subgroup \(g\).

Variance and Precision for Binary Outcomes

For a Bernoulli outcome with risk \(p\), the variance is \(p(1-p)\). In a subgroup with \(n_{1g}\) treated and \(n_{0g}\) control participants, the estimated risk difference is the treated event proportion minus the control event proportion. Under independent sampling and randomization, its estimated variance is

$$ \widehat{\operatorname{Var}}(\hat{\Delta}_g) = \frac{\hat{p}_{1g}(1-\hat{p}_{1g})}{n_{1g}} + \frac{\hat{p}_{0g}(1-\hat{p}_{0g})}{n_{0g}}. $$

The two terms add because the treatment and control groups are distinct. The estimated standard error is the square root of this variance. Since the interaction subtracts two subgroup risk differences, and the subgroup estimates are based on disjoint participants, their estimated variances also add:

$$ \widehat{\operatorname{Var}}(\hat{\delta}) = \widehat{\operatorname{Var}}(\hat{\Delta}_1) + \widehat{\operatorname{Var}}(\hat{\Delta}_0). $$

These formulas make three practical determinants of precision visible. More participants in each subgroup arm reduce variance. Unequal treatment allocation tends to increase variance for a fixed subgroup size. For a risk difference, outcome variance is greatest when risk is near one-half and smaller near zero or one, although rare outcomes can still create practical difficulties if few events are observed.

Worked Example: A Small Subgroup and a Noisy Interaction

Consider a hypothetical randomized trial with 800 participants. Twenty percent are in subgroup 1, so there are 160 participants in that subgroup and 640 in subgroup 0. Assignment is balanced within each subgroup. Suppose the observed risks are 0.30 under control and 0.20 under treatment in subgroup 1, and 0.10 under both assignments in subgroup 0. Calculate the subgroup standard errors and the interaction standard error.

In subgroup 1, there are 80 participants in each arm. The estimated risk difference is \(0.20-0.30=-0.10\), and

$$ \widehat{\operatorname{Var}}(\hat{\Delta}_1) = \frac{0.20(0.80)}{80}+\frac{0.30(0.70)}{80} = \frac{0.16+0.21}{80} = 0.004625. $$

Thus \(SE(\hat{\Delta}_1)=\sqrt{0.004625}=0.0680\). In subgroup 0, there are 320 participants per arm, and

$$ \widehat{\operatorname{Var}}(\hat{\Delta}_0) = \frac{0.10(0.90)}{320}+\frac{0.10(0.90)}{320} = \frac{0.18}{320} = 0.0005625. $$

The subgroup 0 standard error is \(\sqrt{0.0005625}=0.0237\). The estimated interaction is \(-0.10-0=-0.10\), with standard error

$$ SE(\hat{\delta}) = \sqrt{0.004625+0.0005625} = \sqrt{0.0051875} = 0.0720. $$

The interaction estimate is imprecise because one component comes from a subgroup with only 80 people per arm. The overall risk difference, standardized to the trial's subgroup proportions, is \(0.20(-0.10)+0.80(0)=-0.02\). Its estimated variance is \(0.20^2(0.004625)+0.80^2(0.0005625)=0.000545\), giving a standard error of \(0.0233\). This overall contrast is more precise because it averages subgroup estimates rather than subtracting them.

How Subgroup Size and Allocation Enter

Suppose the fraction of the trial in subgroup 1 is \(q\), and assignment is balanced within each subgroup. Then the subgroup sizes are approximately \(Nq\) and \(N(1-q)\), where \(N\) is the total sample size. Define \(v_g=p_{1g}(1-p_{1g})+p_{0g}(1-p_{0g})\), the sum of the two arm-specific outcome variances. The interaction variance is approximately

$$ \operatorname{Var}(\hat{\delta}) \approx \frac{2}{N}\left(\frac{v_1}{q}+\frac{v_0}{1-q}\right). $$

The division by \(q\) means that a rare subgroup contributes less information: with the same total trial size, fewer participants fall into it. The formula also shows why a subgroup interaction can be imprecise even when the full trial is large. If a subgroup is small, its contribution can dominate the interaction variance.

For comparison, the trial-population risk difference weights the subgroup effects by their population proportions. With subgroup proportions treated as fixed, its variance is approximately

$$ \operatorname{Var}(\hat{\Delta}_{\mathrm{overall}}) \approx \frac{2}{N}\left(qv_1+(1-q)v_0\right). $$

When \(q=0.5\) and \(v_1=v_0=v\), the interaction variance is \(8v/N\), while the overall-effect variance is \(2v/N\). The interaction standard error is then twice as large. This comparison concerns precision, not a universal rule that every interaction needs a particular multiple of the sample size. Power also depends on the size of the interaction being targeted and on the outcome variances.

Worked Example: Estimating a Sample Size for an Interaction

Plan a hypothetical trial with subgroup 1 comprising 25% of participants. Suppose planning risks are 0.30 and 0.20 in subgroup 1, and 0.10 and 0.10 in subgroup 0, under control and treatment respectively. Estimate the total sample size needed for 80% power to detect an additive interaction of 0.10 using a two-sided test at \(\alpha=0.05\). Assume balanced assignment within each subgroup.

The planning variances are \(v_1=0.30(0.70)+0.20(0.80)=0.37\) and \(v_0=0.10(0.90)+0.10(0.90)=0.18\). Therefore,

$$ \operatorname{Var}(\hat{\delta}) \approx \frac{2}{N}\left(\frac{0.37}{0.25}+\frac{0.18}{0.75}\right) = \frac{3.44}{N}. $$

A normal-approximation planning equation for a two-sided test is

$$ N \approx \frac{(z_{1-\alpha/2}+z_{1-\beta})^2 C}{\delta^2}, \qquad C=2\left(\frac{v_1}{q}+\frac{v_0}{1-q}\right), $$

where \(1-\beta\) is the desired power and \(C/N\) is the approximate interaction variance. For \(\alpha=0.05\), 80% power, \(z_{0.975}=1.960\), \(z_{0.80}=0.842\), \(C=3.44\), and \(\delta=0.10\):

$$ N \approx \frac{(1.960+0.842)^2(3.44)}{0.10^2} = \frac{7.851(3.44)}{0.01} = 2700.7. $$

The approximation therefore suggests about 2,701 participants before allowing for losses or refinements to the design. It is a planning calculation, not a guarantee of achieved power. For context, at the same absolute target contrast of 0.10, the overall-effect variance coefficient is \(2[0.25(0.37)+0.75(0.18)]=0.455\). The corresponding approximate total is \(7.851(0.455)/0.01=357.2\), or about 358 participants. These totals compare equal-sized target contrasts; an actual overall effect and an interaction usually have different magnitudes and answer different questions.

The normal approximation follows from requiring the expected signal, \(|\delta|\), to exceed a standard-error threshold. Under the null, a two-sided test rejects when the standardized statistic exceeds \(z_{1-\alpha/2}\) in absolute value. For power \(1-\beta\), a useful approximation places the signal that many standard errors beyond the critical value:

$$ \frac{|\delta|}{SE(\hat{\delta})} \approx z_{1-\alpha/2}+z_{1-\beta}. $$

Substituting \(SE(\hat{\delta})\approx\sqrt{C/N}\) and squaring both sides gives the sample-size expression above. The approximation is most defensible when expected event counts are adequate and the normal approximation to the estimator is reasonable; sparse data may require a more tailored design calculation.

Allocation and Outcome Frequency

Within a subgroup of fixed size, allocating substantially more participants to one arm than the other generally reduces precision. For a risk difference, its variance contains one term divided by \(n_{1g}\) and another divided by \(n_{0g}\). If arm variances are equal, the sum \(1/n_{1g}+1/n_{0g}\) is minimized by equal allocation. If variances differ, the allocation minimizing variance for a fixed total is proportional to the arm-specific standard deviations, although practical and ethical constraints may favor another ratio.

Worked Example: Unequal Allocation Within a Subgroup

Suppose a hypothetical subgroup has 200 participants and planning risks are 0.20 under treatment and 0.30 under control. Compare balanced allocation with a 70:30 allocation, keeping the subgroup total fixed.

With 100 participants per arm, the estimated variance is

$$ \frac{0.20(0.80)}{100}+\frac{0.30(0.70)}{100} = 0.003700, \qquad SE=\sqrt{0.003700}=0.0608. $$

With 140 treated and 60 control participants, the variance is

$$ \frac{0.20(0.80)}{140}+\frac{0.30(0.70)}{60} = 0.001143+0.003500 = 0.004643, \qquad SE=\sqrt{0.004643}=0.0681. $$

The unequal allocation increases the standard error by about 12%: \((0.0681/0.0608)-1=0.120\). The larger control-arm variance and smaller control arm both contribute to the increase.

Outcome frequency affects precision through \(p(1-p)\), which is largest at \(p=0.5\). Thus, for a risk-difference analysis with the same arm sizes, risks near one-half tend to produce larger standard errors than risks near zero. This does not mean rare outcomes are always easy to study: the planning effect scale matters, and very few observed events can make estimates unstable or make a normal approximation unreliable.

Worked Example: Outcome Frequency and Interaction Precision

A hypothetical trial has two equally sized subgroups, each with 200 participants and 100 per treatment arm. Compare the interaction standard error if both subgroups have risks 0.05 under control and 0.03 under treatment with a design in which subgroup 1 has those risks but subgroup 0 has risks 0.50 under control and 0.48 under treatment. In both designs, the subgroup risk differences are \(-0.02\), so the interaction is zero; the comparison is about precision, not evidence of heterogeneity.

For risks 0.05 and 0.03, \(v=0.05(0.95)+0.03(0.97)=0.0766\). If both subgroups have these risks, each subgroup risk-difference variance is \(0.0766/100=0.000766\), and

$$ SE(\hat{\delta})=\sqrt{0.000766+0.000766}=0.0391. $$

In the second design, subgroup 0 has \(v_0=0.50(0.50)+0.48(0.52)=0.4996\), so its variance is \(0.4996/100=0.004996\). Subgroup 1 still has variance \(0.000766\), giving

$$ SE(\hat{\delta})=\sqrt{0.000766+0.004996}=0.0759. $$

The common-outcome subgroup has greater variance for its risk difference and therefore makes the interaction less precise in this comparison. In planning, risks should be chosen for each subgroup and arm rather than assuming one overall event rate applies everywhere.

Why the Distinction Matters

A trial powered for an overall treatment effect is not automatically powered to detect effect modification. The overall contrast can be clinically important even when the interaction confidence interval is wide. Conversely, a nonsignificant interaction test does not establish that subgroup effects are equal: it may reflect limited information, particularly in a small subgroup. Precision calculations help distinguish “no clear evidence of difference” from a design that could have reliably detected only very large differences.

The formulas also show why subgroup prevalence belongs in design planning. If a subgroup makes up 10% of the target population, a trial with 1,000 participants has only about 100 people in that subgroup before dividing them between treatment arms. Increasing the total sample size, enriching recruitment for the subgroup, or using a design with stratified recruitment can improve its precision. If recruitment changes subgroup proportions, however, estimates and weighting must still match the intended target population.

Common pitfall: “The treatment effect is significant in subgroup 1 but not significant in subgroup 0, so the treatment works differently between them.” This does not follow. A difference between significance decisions is not a test of the difference between effects. Estimate the interaction \(\hat{\delta}=\hat{\Delta}_1-\hat{\Delta}_0\) and use its standard error and confidence interval to assess how precisely the subgroup contrast has been estimated.
Key takeaway: Interaction precision depends on the information in each subgroup-treatment cell. Small subgroup size, imbalanced allocation, and outcome risks near one-half can increase the standard error for a risk-difference interaction. Plan directly for the interaction of scientific interest rather than assuming that adequate power for an overall effect will suffice.

Check Your Understanding

Use the variance and planning ideas in this tutorial to answer these questions.

  1. Why does the variance of an interaction contrast add the variances of both subgroup risk differences?
  2. With a fixed total sample size and equal arm-specific outcome variances, what treatment allocation minimizes the variance of a subgroup risk difference?
  3. How would a subgroup prevalence of 10%, rather than 50%, usually affect the precision of an interaction if total sample size and risks were otherwise unchanged?
  4. For a binary outcome on the risk-difference scale, at what risk is \(p(1-p)\) largest, and what does that imply for variance?
  5. Why is “significant in one subgroup but not the other” not sufficient evidence of treatment-effect modification?
Clinical Biostats