Why Model an Interaction?
A condition may be associated with a change in a cell type’s relative abundance for some donors, but a weaker or stronger change for donors with a particular characteristic. For example, the condition contrast might differ by age group or baseline clinical category. A model with only a condition main effect assumes a common condition contrast across the covariate values represented in the model. An interaction allows that contrast to vary in a specified way.
Here the outcome is a donor-level composition contrast, such as the log ratio of the proportion of cell type A to a reference cell type R. This follows the earlier material on interpreting log-ratio effects: a change in the log ratio corresponds to a multiplicative change in the A-to-R ratio, not necessarily to the same change in A’s percentage-point proportion. The interaction asks whether the condition-associated change in that contrast differs with a donor characteristic.
Specify the Model Before Interpreting It
Let \(Y_i=\log(p_{iA}/p_{iR})\) be the log ratio for donor \(i\), where \(p_{iA}\) and \(p_{iR}\) are the donor’s proportions for cell types A and R. Suppose condition \(C_i\) is coded 0 for control and 1 for treated, and a binary donor characteristic \(Z_i\) is coded 0 or 1. A linear interaction model is
The model’s mean is specified by the four coefficients; the error \(\varepsilon_i\) represents donor-level variation not captured by those terms. The model requires independent donor-level errors for the usual ordinary least-squares standard errors, an adequately specified mean structure, and finite residual variance. For exact small-sample t-based inference with the classical pooled OLS standard error, errors must be independent, normally distributed, and have a common variance, and the model must have full rank. In larger samples, approximate Wald inference may be reasonable when its standard errors are appropriate. If the same donor contributes observations under multiple conditions, those observations are not independent; the analysis must account for within-donor dependence, as in repeated-measures models.
The coding determines the coefficient meanings. At \(Z=0\), the modeled control mean is \(\beta_0\) and the treated mean is \(\beta_0+\beta_C\). At \(Z=1\), those means are \(\beta_0+\beta_Z\) and \(\beta_0+\beta_Z+\beta_C+\beta_{CZ}\). Thus the condition contrasts are
Each \(\Delta\) is a difference in mean log ratios between treated and control donors in that stratum. Exponentiating a contrast gives the ratio of the treated-to-control A:R ratios. The interaction coefficient exponentiated, \(\exp(\beta_{CZ})\), is a ratio of those condition-related fold changes across the two strata. It is not itself a difference in cell-type percentages.
Worked Example: Calculate the Two Stratum-Specific Contrasts
Suppose a hypothetical, balanced study has four independent donors in each condition-by-characteristic group. The table gives the group mean donor-level log ratio \(Y=\log(p_A/p_R)\). Values are illustrative, not observations from a real study.
| Characteristic stratum | Control mean log ratio | Treated mean log ratio |
|---|---|---|
| \(Z=0\) | -1.20 | -0.90 |
| \(Z=1\) | -0.70 | 0.20 |
For \(Z=0\), the treated-minus-control contrast is \(-0.90-(-1.20)=0.30\) log-ratio units. Exponentiating gives \(\exp(0.30)=1.350\): the treated-to-control A:R ratio is 1.350 in this stratum. For \(Z=1\), the contrast is \(0.20-(-0.70)=0.90\), and \(\exp(0.90)=2.460\). The difference between the contrasts is \(0.90-0.30=0.60\), so the estimated interaction is 0.60 log-ratio units.
Equivalently, the ratio of the stratum-specific fold changes is \(\exp(0.60)=1.822\). The estimated treated-to-control fold change in A:R is therefore about 1.822 times as large in stratum \(Z=1\) as in stratum \(Z=0\). These are relative-ratio comparisons; they do not, by themselves, give percentage-point changes in cell type A.
Test the Interaction, Not Two Separate Stories
For a binary covariate, the direct null hypothesis of no variation in the condition contrast is \(H_0:\beta_{CZ}=0\), against \(H_a:\beta_{CZ}\ne 0\) for a two-sided test. A Wald statistic divides the estimated interaction by its standard error. Under the null and the model’s inference assumptions, it is approximately standard normal in a large sample; in a linear model with suitable normal-error assumptions, a corresponding t test may be used with residual degrees of freedom.
A confidence interval for the interaction quantifies uncertainty in the difference between stratum-specific condition effects. A statistically detectable interaction is evidence that the modeled effects differ, not proof that the covariate causes that difference. Conversely, failure to reject \(H_0\) does not establish that the effects are identical; an interval may still include meaningful differences.
Worked Example: Wald Test for Effect Modification
In a hypothetical donor-level fit, suppose the interaction estimate is \(\widehat{\beta}_{CZ}=0.7997\) log-ratio units with \(SE(\widehat{\beta}_{CZ})=0.3200\). Suppose the estimated condition effect at \(Z=0\) is \(\widehat{\beta}_C=-0.2500\). For this example, assume independent donor-level errors, an adequate mean model, and a sample size for which the normal approximation used in the Wald test is suitable.
The interaction statistic is
The two-sided standard-normal p-value is \(2P(Z\geq 2.4991)=0.01245\). At \(\alpha=0.05\), reject \(H_0:\beta_{CZ}=0\). Under the model, the evidence supports a difference in condition effects across the two characteristic strata.
The estimated condition effect at \(Z=1\) is \(-0.2500+0.7997=0.5497\) log-ratio units. Exponentiating gives \(\exp(-0.2500)=0.7788\) for \(Z=0\) and \(\exp(0.5497)=1.733\) for \(Z=1\). Thus the estimated treated-to-control A:R ratio is lower in the first stratum and higher in the second, relative to each stratum’s control ratio. The interaction interval using the normal critical value 1.96 is \(0.7997\pm1.96(0.3200)=[0.1725,1.4269]\) log-ratio units. It excludes zero; exponentiating its endpoints gives a ratio-of-fold-changes interval of approximately \([1.188,4.166]\). This interval is wide, so the estimated direction is clearer than the precise magnitude.
Continuous Covariates and Centering
A donor characteristic need not be binary. For a continuous \(Z_i\), the same model states that the condition contrast at value \(z\) is \(\beta_C+\beta_{CZ}z\). The coefficient \(\beta_{CZ}\) is the change in the condition log-ratio contrast for a one-unit increase in \(Z\). Its units therefore depend on the scale of the covariate. Centering \(Z\), for example by subtracting its sample mean, makes \(\beta_C\) the condition contrast at the mean covariate value rather than at \(Z=0\); it does not change the fitted values or the interaction slope.
A linear interaction assumes that this change is linear over the observed covariate range. If the true effect modification is curved, one straight-line slope may misrepresent it. Any more flexible model must be specified and tested with a method appropriate to its terms; the simple coefficient test below is for a single linear interaction.
Worked Example: Interpret an Interaction per Ten Years
Suppose age is centered and measured in units of ten years, and a hypothetical model estimates \(\widehat{\beta}_C=-0.1000\) and \(\widehat{\beta}_{CZ}=0.2500\). The condition contrast at the centered age is \(-0.1000\). At a covariate value two units above the center (20 years higher), the contrast is
The corresponding ratio of treated-to-control A:R ratios is \(\exp(0.4000)=1.492\). The interaction estimate means that each ten-year increase in age is associated with a 0.2500-unit increase in the condition log-ratio contrast under this model, or a multiplicative factor of \(\exp(0.2500)=1.284\) in that treated-to-control ratio. It does not imply that age causes the change; it describes the fitted conditional association.
At a value \(z\), uncertainty for the combined contrast must use the covariance between coefficient estimates:
For illustration, if the two variances are \(0.0400\) and \(0.0100\), and their covariance is \(-0.0050\), then at \(z=2\) the variance is \(0.0400+4(0.0100)+4(-0.0050)=0.0600\), giving \(SE=\sqrt{0.0600}=0.2449\). Using only the interaction standard error would omit uncertainty in the condition coefficient and the covariance term.
Justification of the Binary Interaction Contrast
The interpretation follows directly by substituting the four condition-covariate combinations into the model. At \(C=0,Z=0\), the mean is \(\beta_0\); at \(C=1,Z=0\), it is \(\beta_0+\beta_C\). Subtracting gives \(\Delta_0=\beta_C\). At \(C=0,Z=1\), the mean is \(\beta_0+\beta_Z\); at \(C=1,Z=1\), it is \(\beta_0+\beta_Z+\beta_C+\beta_{CZ}\). Subtracting gives \(\Delta_1=\beta_C+\beta_{CZ}\). Therefore,
This derivation also explains why the interaction test is the direct test of whether the two condition contrasts differ. Testing the condition effect separately in each stratum answers two different questions; comparing whether one stratum’s p-value is below a threshold and the other’s is not does not test whether the effects differ.
Assumptions, Diagnostics, and Alternatives
Before interpreting an interaction, check that the design supports it. There must be observations in the condition-by-covariate combinations needed for the contrast. Sparse or empty combinations can make estimates unstable or non-identifiable. For a continuous covariate, examine whether both conditions cover comparable ranges; an estimated contrast far outside their overlap is extrapolation rather than a well-supported comparison. Also verify coding, units, and the reference value, since these determine the meaning of the main-effect coefficient.
Inspect residuals and influential donors for unusual patterns, variance differences, and observations that dominate the fitted interaction. A linear mean trend for a continuous covariate should be plausible over its observed range. For log-ratio outcomes, zeros in a component make the unmodified log ratio undefined; the chosen zero-handling strategy must be justified and sensitivity to it assessed. Dependence among multiple observations from the same donor must also be modeled rather than treated as independent replication.
The main alternatives answer different questions. A model with condition and covariate main effects but no interaction estimates one common condition contrast and is more precise if that restriction is appropriate, but cannot represent effect modification. Separate stratum-specific analyses can display the contrasts, but do not automatically provide a direct test of their difference and may have lower precision. A continuous linear interaction uses the covariate efficiently when a linear trend is credible; categorizing a continuous characteristic changes the estimand and discards information. Whichever model is used, multiplicity across many cell types or many interaction tests still requires suitable control.
Common Pitfalls
- Reading \(\beta_C\) as the universal condition effect. With an interaction, it is the effect only at \(Z=0\); state the coding and report the other stratum’s contrast or the covariate-specific contrast.
- Comparing separate p-values. “Significant in one group but not the other” is not a test of interaction. Test \(\beta_{CZ}=0\) directly.
- Calling a log-ratio change a percentage-point change. Exponentiation gives a fold change in a relative ratio. A percentage-point interpretation requires additional information about the composition and its denominator.
- Over-interpreting an interaction p-value. It does not establish causality, guarantee a practically important difference, or show that the model’s functional form is correct.
- Ignoring overlap or donor dependence. Empty covariate-condition groups, extrapolation, or repeated observations analyzed as independent can invalidate the intended comparison and its uncertainty estimate.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- For \(Y=\beta_0+\beta_C C+\beta_Z Z+\beta_{CZ}CZ+\varepsilon\), with binary \(C\) and \(Z\), write both condition contrasts and their difference.
- An estimated interaction is \(-0.30\) log-ratio units. What is the ratio of condition-related fold changes between \(Z=1\) and \(Z=0\)?
- Why does finding \(p<0.05\) for the condition effect in one stratum and \(p>0.05\) in another not establish an interaction?
- For a continuous covariate, \(\widehat{\beta}_C=0.20\) and \(\widehat{\beta}_{CZ}=-0.05\). Find the condition contrast at \(z=3\).
Solutions. (1) The contrasts are \(\Delta_0=\beta_C\) and \(\Delta_1=\beta_C+\beta_{CZ}\); subtracting gives \(\Delta_1-\Delta_0=\beta_{CZ}\). (2) The ratio of fold changes is \(\exp(-0.30)=0.7408\), so the estimated fold change is smaller in \(Z=1\) than in \(Z=0\). (3) The two p-values test separate null hypotheses and can differ because of standard errors, even when the estimated effects are similar. The direct test compares effects by testing \(\beta_{CZ}=0\). (4) The contrast is \(0.20+(-0.05)(3)=0.0500\) log-ratio units; exponentiating gives \(\exp(0.0500)=1.051\) for the treated-to-control relative-ratio fold change at \(z=3\).