Tutorials › Econometrics (Graduate) › Deriving Tests for Prespecified Effect Heterogeneity

Treatment Effect Heterogeneity · Tutorial 832 of 952

Deriving Tests for Prespecified Effect Heterogeneity

Learn to construct and interpret Wald tests for heterogeneous treatment effects, and see why covariance estimates and the choice of reference population matter.

Advanced 11 min read

What You'll Learn

  • Express a joint null of equal subgroup treatment effects as restrictions on interaction coefficients.
  • Derive a Wald statistic from the estimated restrictions and their covariance matrix.
  • Test a prespecified contrast between subgroup effects using its full covariance-based standard error.
  • Aggregate subgroup effects for a specified reference population and calculate uncertainty with the full covariance matrix.
  • Interpret how covariance estimates and target-population weights can change conclusions.

Why Test Prespecified Effect Heterogeneity?

An estimated treatment effect can differ across subgroups, but observed differences alone do not establish that the population effects differ. Sampling variation matters, and so does the question being asked: a joint test of all treatment interactions is not the same as a test of one contrast between two subgroup effects. Both require the estimated covariance among the relevant coefficients.

This tutorial develops Wald tests for hypotheses specified in advance. The tests are useful when a linear interaction model represents treatment effects across a finite set of subgroups. The inference concerns the chosen model and the specified target: changing the contrast or the population used to average subgroup effects can change the result.

Model and Hypotheses

Suppose the treatment indicator \(D_i\) is binary and each unit belongs to exactly one of \(G\) prespecified subgroups. Use subgroup 1 as the reference category. A linear interaction model for the conditional mean can be written as

$$ E[Y_i\mid D_i,S_i,X_i] = m(X_i,S_i)+D_i\left(\tau_1+\sum_{g=2}^{G}\gamma_g\,1\{S_i=g\}\right), $$

where \(S_i\) denotes subgroup membership, \(X_i\) denotes other included covariates, and \(m(\cdot)\) collects the non-treatment terms. The implied treatment-effect parameter for subgroup 1 is \(\tau_1\); for subgroup \(g\geq 2\), it is \(\tau_g=\tau_1+\gamma_g\). Thus \(\gamma_g\) is the difference between subgroup \(g\)'s effect and subgroup 1's effect.

Interpreting these parameters causally requires the relevant identification conditions, such as random assignment or appropriate conditional exchangeability, consistency, and positivity, as well as a correctly specified conditional-mean model for the estimand at issue. The Wald calculations below concern sampling uncertainty in the model parameters; they do not by themselves establish those causal conditions.

Definition: A Wald test assesses a specified vector of restrictions on an estimated parameter vector by comparing the estimated restriction to its estimated covariance. For \(q\) restrictions, its statistic is asymptotically compared with a chi-square distribution with \(q\) degrees of freedom under the null, subject to regularity conditions.

Let \(\hat\beta\) be the full coefficient estimator and let \(\widehat V\) estimate its covariance matrix. Write the null restrictions as \(R\beta=r\), where \(R\) is a specified matrix and \(r\) is a specified vector. The estimated restriction is \(R\hat\beta-r\), with estimated covariance \(R\widehat V R'\). If that covariance is nonsingular, the Wald statistic is

$$ W=(R\hat\beta-r)'(R\widehat V R')^{-1}(R\hat\beta-r). $$

For \(q\) linearly independent restrictions, under the null and standard large-sample conditions, \(W\) has an asymptotic \(\chi^2_q\) distribution. These conditions include asymptotic normality of the estimator and consistent covariance estimation; the restriction covariance must have full rank. The covariance estimate may be model-based or robust, but it must be appropriate for the sampling or assignment structure.

Joint Tests of Interaction Coefficients

In the model above, the null that all specified subgroup effects equal the reference subgroup effect is

$$ H_0:\gamma_2=\gamma_3=\cdots=\gamma_G=0. $$

This is a joint test of \(q=G-1\) restrictions. Rejection indicates evidence that at least one of these prespecified effects differs from the reference effect; it does not identify which subgroup differs, and it does not imply that every subgroup effect differs. The test is not a test that the treatment effect is zero in every subgroup. That different null would also restrict the reference treatment coefficient.

Worked Example: Joint Test of Two Interactions

Suppose a prespecified model compares three subgroups. The two estimated interaction coefficients, in outcome points, are \(\hat\gamma_2=1.2\) and \(\hat\gamma_3=-0.8\). Their estimated covariance matrix is

$$ \widehat V_\gamma= \begin{pmatrix} 0.16&0.04\\ 0.04&0.09 \end{pmatrix}. $$

Test \(H_0:\gamma_2=\gamma_3=0\) against the alternative that at least one is nonzero. The determinant is \(0.16(0.09)-0.04^2=0.0128\), so the inverse is

$$ \widehat V_\gamma^{-1} = \frac{1}{0.0128} \begin{pmatrix} 0.09&-0.04\\ -0.04&0.16 \end{pmatrix} = \begin{pmatrix} 7.03125&-3.125\\ -3.125&12.5 \end{pmatrix}. $$

The Wald statistic is

$$ W= \begin{pmatrix}1.2&-0.8\end{pmatrix} \begin{pmatrix} 7.03125&-3.125\\ -3.125&12.5 \end{pmatrix} \begin{pmatrix}1.2\\-0.8\end{pmatrix} =10.125+6+8=24.125. $$

Under \(H_0\), the reference distribution is \(\chi^2_2\), giving \(p=\exp(-24.125/2)\approx0.00000577\). At the 5% level, reject the joint null. The data provide strong evidence that at least one of these two subgroup effects differs from the reference subgroup effect under the model and covariance assumptions. The statistic uses the off-diagonal covariance, not just the two marginal variances.

Testing a Contrast Between Subgroup Effects

A contrast is a specified linear combination of parameters. For example, the difference between subgroup 2 and subgroup 3 effects is \(\tau_2-\tau_3=\gamma_2-\gamma_3\). More generally, if the target is \(c'\beta\), its estimate is \(c'\hat\beta\), and its estimated variance is \(c'\widehat Vc\). A two-sided Wald test of \(H_0:c'\beta=0\) uses the squared statistic \((c'\hat\beta)^2/(c'\widehat Vc)\), asymptotically compared with \(\chi^2_1\). Equivalently, the signed statistic \(c'\hat\beta/\sqrt{c'\widehat Vc}\) is compared with a standard normal distribution.

Worked Example: Comparing Two Nonreference Subgroups

Suppose the estimated treatment effects are \(\hat\tau_1=1.5\), \(\hat\tau_2=1.1\), and \(\hat\tau_3=2.3\) outcome points. The estimated variances of the interaction coefficients \(\hat\gamma_2\) and \(\hat\gamma_3\) are \(0.25\) and \(0.36\), and their estimated covariance is \(0.10\). Test whether the effects in subgroups 2 and 3 are equal.

The estimated contrast is \(\hat\tau_2-\hat\tau_3=(1.5+1.1)-(1.5+2.3)=1.1-2.3=-1.2\) points. Since this contrast is \(\gamma_2-\gamma_3\), its estimated variance includes the covariance term:

$$ \widehat{\operatorname{Var}}(\hat\gamma_2-\hat\gamma_3) =0.25+0.36-2(0.10)=0.41. $$

Thus \(SE=\sqrt{0.41}\approx0.6403\) points, and the signed Wald statistic is \(-1.2/0.6403\approx-1.874\). The two-sided normal-reference p-value is approximately \(0.061\). The 95% Wald interval is

$$ -1.2\pm1.96\sqrt{0.41} \approx[-2.455,\;0.055]\text{ points}. $$

At the two-sided 5% level, this test does not reject equality: the p-value exceeds 0.05, and the interval includes zero. The estimated difference is \(-1.2\) points, but the uncertainty is substantial enough that the data do not rule out no difference at this level. This is not evidence that the subgroup effects are exactly equal.

Reference Populations and Aggregated Effects

Subgroup effects can also be combined into an average for a specified reference population. Let \(\hat{\boldsymbol\tau}\) collect the subgroup effect estimates and let \(w_g\) be fixed target-population weights, with \(w_g\geq0\) and \(\sum_g w_g=1\). The weighted estimate is \(\hat\theta_w=\mathbf{w}'\hat{\boldsymbol\tau}\). Its variance is \(\mathbf{w}'\widehat V_\tau\mathbf{w}\), where \(\widehat V_\tau\) is the full estimated covariance matrix of the subgroup effects. The weights define the target: they are not automatically the proportions in the analysis sample.

A useful justification follows from the variance of a linear transformation. If \(\hat{\boldsymbol\tau}\) has covariance matrix \(V_\tau\), then

$$ \operatorname{Var}(\mathbf{w}'\hat{\boldsymbol\tau}) =E\left[\{\mathbf{w}'(\hat{\boldsymbol\tau}-E[\hat{\boldsymbol\tau}])\}^2\right] =\mathbf{w}'V_\tau\mathbf{w}. $$

Expanding this expression gives \(\sum_g w_g^2\operatorname{Var}(\hat\tau_g)+2\sum_{g<h}w_gw_h\operatorname{Cov}(\hat\tau_g,\hat\tau_h)\). The covariance terms therefore matter whenever subgroup estimates are statistically related.

Worked Example: Inference for a Prespecified Target Population

Consider three subgroup treatment-effect estimates of \(0.8\), \(0.5\), and \(-1.6\) outcome points. A prespecified target population assigns weights \(0.70\), \(0.20\), and \(0.10\). Suppose the estimated covariance matrix of these subgroup effects is diagonal, with variances \(0.25\), \(1\), and \(4\) points squared, and zero off-diagonal covariances.

The weighted estimate is

$$ \hat\theta_w=0.70(0.8)+0.20(0.5)+0.10(-1.6) =0.56+0.10-0.16=0.50\text{ points}. $$

Using the stated covariance matrix, its estimated variance is

$$ \widehat{\operatorname{Var}}(\hat\theta_w) =0.70^2(0.25)+0.20^2(1)+0.10^2(4) =0.1225+0.0400+0.0400=0.2025. $$

Therefore \(SE=\sqrt{0.2025}=0.45\) points. The 95% Wald interval is

$$ 0.50\pm1.96(0.45) =[-0.382,\;1.382]\text{ points}. $$

This interval includes zero, so the weighted effect is not statistically distinguishable from zero at the two-sided 5% level using this Wald approximation. The estimate and interval refer to the population defined by the 70%, 20%, and 10% weights. Different target weights could produce a different average and a different standard error. If the weights themselves are estimated rather than fixed, their uncertainty may also need to be included.

Why Covariance and the Target Matter

The covariance matrix is part of the inferential result, not a secondary detail. For a contrast, positive covariance can reduce the variance of a difference; negative covariance can increase it. For a joint test, covariance affects the geometry of the estimated coefficient vector relative to its uncertainty. Using only standard errors, or silently setting covariances to zero, can therefore change a test statistic, interval, or conclusion.

The reference population is equally substantive. A weighted average answers a question about effects for the population represented by the specified weights. A sample-weighted average answers a different question if the sample subgroup proportions differ from the target population proportions. State the target weights and the units of the outcome when reporting an aggregate effect.

Common Pitfall

Common mistake: Treating a nonsignificant joint test as proof that subgroup effects are identical, or treating an aggregate estimate as if it applied to every subgroup. Correction: A Wald test quantifies evidence against its particular null, subject to the model and covariance assumptions. Failure to reject does not establish equality. An aggregate effect is specific to its weighting population and can conceal meaningful variation across subgroups.

For transparent reporting, name the restrictions or contrast, give the coefficient estimate and covariance method, report the test statistic with degrees of freedom and p-value, and identify the target population for any weighted average. A statistically significant joint test says that at least one restricted coefficient departs from its null value; a prespecified contrast gives a more focused answer to a particular comparison.

Check Your Understanding

Work through these questions using the definitions and results above.

  1. In a model with four subgroups and subgroup 1 as the reference, how many restrictions are in the joint null that all subgroup effects equal the reference effect?
  2. Why does the variance of the estimated difference between two subgroup effects include a covariance term?
  3. A joint interaction test rejects its null. What can you conclude, and what can you not conclude, about the individual subgroup effects?
  4. If subgroup estimates have zero covariance and fixed weights, how is the variance of their weighted average calculated?
  5. Why might an average effect weighted by the analysis sample’s subgroup proportions answer a different question from one weighted for a prespecified target population?
Clinical Biostats