Interaction contrast 2026-10-07
An interaction contrast compares a treatment difference across levels of another factor. A nonzero difference of differences shows that an additive representation of those cell means is inadequate. Its standard error must use the error stratum in which that interaction term is randomized.
Interaction (statistics) 2026-10-07
A statistical interaction means that the effect of one predictor depends on another on the chosen response scale. In a linear regression, an interaction term changes the slope in to . Whether interaction is present depends on the comparison scale; additive effects and multiplicative effects use different null contrasts. Comparing subgroup effects requires an interaction contrast, rather than contrasting their separate significance labels.
For independent strata, each containing an contingency table, test independence of the two table variables within every stratum. Under adequate expected counts and the usual multinomial distribution sampling assumptions, each stratum's Pearson chi-squared statistic has asymptotic chi-squared distribution with statistical degrees of freedom. Their sum has asymptotic chi-squared distribution with statistical degrees of freedom, by the additivity of independent chi-squared distributions. This is a test of conditional independence, not of equality of a common effect across strata; the latter needs an interaction contrast or another specified homogeneity test.
Conditioning on marital status produces five contingency tables. In each, compare the conditional row percentages. The following differences are the sample proportion with some bad experiences minus the sample proportion without them, in percentage points; negative very-safe differences mean fewer respondents feeling very safe in the former group.
Marital-status stratumDifference: very safeDifference: unsafeReported Pearson's chi-squared test p-valueCramér's VGoodman and Kruskal's gamma
Single
Married
Living with a partner (inconsistent; see below)
Divorced
Widowed
The p-values test independence within the respective strata; the magnitudes and directions come from the conditional percentages and association measures. Differences in the table are calculated from the counts before rounding.
Among single respondents, the very-safe sample proportion changes from to , while the unsafe sample proportion changes from to . The direction resembles the weak pooled pattern, but supplies little evidence against independence in this stratum. This is not evidence that the population association is exactly zero.
Among married respondents, the very-safe sample proportion changes from to and the fairly-safe sample proportion rises from to . Unsafe remains almost unchanged, versus . Thus the within-stratum association again chiefly shifts very safe toward fairly safe. Its is below the significance level, while still indicates a small association.
For respondents living with a partner, very safe changes from to , fairly safe from to , and unsafe from to . The very-safe difference is larger than in the married stratum. The printed p-value would be just below the conventional significance level. However, this particular output is internally inconsistent: recalculating Pearson's chi-squared test from its six displayed counts gives , , and . The reported agrees with the counts, whereas the printed would itself imply for two statistical degrees of freedom, rather than the printed . Using the displayed counts, this stratum does not reject independence at . The source PDF itself contains these incompatible figures; this is not resolved by rounding.
Among divorced respondents, very safe changes from to , but unsafe also decreases, from to , as fairly safe increases from to . This is a redistribution toward the middle category, not a simple shift toward greater unsafety. The near-zero gamma, , reflects the lack of a consistent ordinal direction, while can still register distributional differences without a direction. The p-value does not reject independence.
Among widowed respondents, very safe changes from to , and unsafe from to . The ordinal association is positive on the chosen ordering, with gamma . Its lack of conventional statistical significance, , does not imply a smaller estimated association than in the married group: the widowed stratum has only complete observations, versus in the married stratum, and therefore less precision. All five tables have sufficiently large expected counts for the reported approximations; even the smallest expected count is about .
Figure 1.
Derived safety-category differences and unadjusted uncertainty by marital-status stratum
. Details.
The plot uses large-sample Wald confidence intervals for the difference of independent sample proportions within each stratum. They concern the individual category contrasts, whereas the tabulated Pearson's chi-squared tests compare the full three-category distributions. The intervals are unadjusted for multiple hypothesis testing; the pooled row reuses the stratum observations, so it is not a sixth independent sample.
In the elaboration model, the persistence of a generally weak positive ordinal pattern within four strata is closer to partial replication than to a complete explanation of the pooled association by marital status. The differences in estimated patterns suggest possible specification: the divorced group's shift toward the middle category differs from the widowed group's shift toward unsafe. They do not by themselves establish population effect modification. In particular, significant and nonsignificant results need not differ significantly; compare the effects using an interaction contrast or a fitted model with the appropriate interaction terms, rather than comparing their separate p-values.[ref]
One additional omnibus check can be derived from the supplied tables without assuming a common effect. Recalculating the five statistics from the counts, including the corrected living-with-partner statistic, the joint conditional independence test for stratified contingency tables gives
Under independent-stratum sampling this tests independence within every stratum jointly; it does not test whether the association is homogeneous across strata. It does not reject at , but this alone does not establish that stratification removed the population association: its ten-degree-of-freedom alternative is less focused than the pooled two-degree-of-freedom test, and nonrejection is not proof of equality.
The elaboration model also distinguishes an antecedent confounder from an intervening causal mediator. These cross-sectional tables do not establish the relevant time ordering or identify either role for marital status. Five separate stratum tests further require caution about multiple hypothesis testing: for example a Bonferroni correction at familywise would use per test, below all five individual p-values. That caution changes the interpretation of selected significance labels, not the observed conditional percentages.
The estimated patterns vary across strata, but the tables neither establish a population interaction nor prove that marital status explains away the association.
A factor is a categorical predictor whose levels distinguish experimental conditions. Two factors have a statistical interaction when the effect of changing one depends on the other's level. For cell means , absence of an interaction means ; equivalently, is independent of .
Index thickness by , temperature by , wash by and replication by . The full factorial design has the normal linear model
The errors are independent with a common positive variance. Sum-to-zero constraints in each factor index, or the displayed treatment coding, identify the mean coefficients. This full model allows an arbitrary mean in each of the sixteen cells.
The missing statistical degrees of freedom, in the output order, are . The first seven entries total fifteen; with the regression intercept there are sixteen mean coefficients among thirty-two observations, leaving sixteen residual statistical degrees of freedom. Balanced factorial orthogonality makes the term sums of squares in ANOVA independent of their ordering.
All terms involving wash have nonsignificant individual F-tests, and it is useful to test their removal jointly. The reduced model omits twelve mean coefficients. Its residual sum of squares is , compared with for the full model, so the nested-model F-test gives
There is no detected wash effect over the four tested durations. Removing its main effect and all its interaction terms respects the principle of marginality. Retaining the very large thickness-by-temperature interaction is essential: the thickness effect changes substantially with temperature.
With numeric indicators , treatment coding expresses the reduced fitted mean as
Thus the thin/low, thick/low, thin/high and thick/high fitted means are , respectively, at every wash level. Each is the sample mean of eight observations. The equal-cell replication variance formula therefore gives
Alternatively, use the variance of a fitted regression mean with : . Individual coefficient standard errors cannot simply be added; their covariances enter the fitted-mean calculation.
Increasing temperature raises fitted lustre by for thin film and for thick film. Increasing thickness raises it by at low temperature and at high temperature. Their difference, , is the estimated interaction contrast; its standard error is , giving on twenty-eight statistical degrees of freedom. The interaction plot shows this strong departure from parallel mean lines, while the wash panel shows the much smaller variation across wash durations. Neither the nonsignificant wash test nor the plot proves that its true effect is exactly zero.
Figure 1.
Plastic-film lustre: thickness–temperature interaction and variation across wash durations
. Details.
A regression factor is a categorical predictor represented by level indicators and contrasts. Treating year as a regression factor permits arbitrary differences between the three yearly means, reflecting conditions such as weather, rather than imposing a linear time trend.
Let be the yield for seed variety , fertiliser level , and year . A treatment-coded two-factor normal linear model with additive year effects is
with independent errors. The unrestricted coefficients are : six parameters for twelve observations. Equivalently use baseline-zero variety, fertiliser, and interaction arrays. There are no year-treatment interactions in this fit.
Dividing each sum of squares by its statistical degrees of freedom gives the completed analysis of variance:
In particular, the missing interaction statistic is . Its null hypothesis is , against : the change in mean yield from high fertiliser is the same for both varieties. Under the null hypothesis and the independent homoscedastic normal linear model, this nested-model F-test has distribution . The printed -value 0.001137 strongly rejects no interaction.
Do not drop fertiliser just because its main-effect ANOVA row has . In this balanced factorial design that row measures a fertiliser effect averaged over varieties; large opposite effects can cancel. The strongly supported interaction requires retaining its associated main effects by regression model hierarchy. Seed and year also have evidence of effects in their ANOVA rows, so this table alone gives no compelling simplification of the fitted terms.
The interaction contrast is , with standard error 0.7946. The fitted high-minus-low fertiliser effect is for variety 1 but for variety 2. The fitted variety-2-minus-variety-1 contrast is under low fertiliser and under high fertiliser. Thus variety 2 performs best under low fertiliser, while high fertiliser benefits variety 1 and reduces variety 2's fitted yield. The marginal fertiliser effect is only .
The four fitted means in the baseline year are for respectively. Add in 2005 and in 2006 to every fitted mean. The 2005 coefficient has under a test of a zero contrast with 2004; the analogous 2006 contrast has . The latter is lack of evidence for a difference, not proof that the yearly means coincide. Standard errors for the combined contrasts require the coefficient covariance matrix. The experiment is small: residual standard error is 0.6882 on only six statistical degrees of freedom. If the same fields were reused, possible within-field dependence and field allocation would need checking before treating the fitted error independence as established.
This produces a split-plot design: assign spray to whole orchards, with six sprayed and six unsprayed, then independently randomize ten trees to each pruning method inside every orchard. Orchards remain experimental units for spray; individual trees become experimental units for pruning. Pruning contrasts and the spray-by-pruning interaction term now lie in the within-block ANOVA stratum, while spray is tested between orchards.
The between-orchard ANOVA stratum has eleven statistical degrees of freedom, split into one for spray and ten for error. The within-orchard ANOVA stratum has 348, split into two for pruning, two for the interaction term and 344 for error. This pooling of within-orchard error is appropriate under the stated compound-symmetry covariance model; additional orchard-specific pruning variation would need its own variance component rather than this simplified error model.
The shared orchard effect cancels in a pruning difference within an orchard. Its variance is , so averaging across twelve orchards gives
The spray contrast still compares means of six orchards per group, each based on 30 trees, so its estimated variance remains . For a difference of pruning differences between the two spray groups, each group's pruning difference has estimated variance , and the resulting interaction contrast has estimated variance , compared with in the original allocation.
Splitting pruning within orchards improves pruning and interaction precision without extra trees, and gives spray a less sparse error estimate; it does not reduce the spray contrast's variance. This option requires tree-level pruning to be practical without interference between neighboring trees. The numerical gains, like those in the other options, assume the current variance components remain applicable next year.