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) Created 2026-10-07 Updated 2026-11-05
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.
Every displayed age stratum has a higher reported-Yes proportion among Populist respondents, but the size varies considerably. The largest difference is at ages 25–34 and the smallest at 45–54. The omnibus tests reject within-stratum independence for ages 25–34 and 35–44, but not for the other three groups; comparing those significance labels is not itself a test of statistical interaction.
The five strata contain 298, 291, 339, 296 and 405 complete cases. They sum to 1629 and reproduce every cell of the overall table, so the comparison is a coherent age stratification. Each body percentage estimates a blocking-response conditional distribution within a particular age and populism combination. Not know is retained as the third valid response. The ordinal statistics discussed below are numerical summaries of the displayed order only, because that response order has no established behavioural rank.
For ages 18–24, reported blocking is among Not-populist respondents versus among Populist respondents, a difference of about 8.11 percentage points. No is 71.43% versus 66.00%, and Not know is 9.18% versus 6.50%. The Pearson result is on 2 statistical degrees of freedom, ; the likelihood-ratio test gives , . Thus neither rejects at 5%. The minimum expected frequency is 7.235, so no cell falls below five. Cramér's V and the generalized phi coefficient are about 0.095, with contingency coefficient about 0.094. The ordered-label summaries are gamma 0.203, Somers' D 0.095, tau-b 0.092 and tau-c 0.084. Both lambdas are zero. These figures allow a positive descriptive Yes difference alongside considerable uncertainty; nonrejection does not establish identical response distributions.
For ages 25–34, reported blocking is versus , a difference of about 19.57 percentage points. No falls from 75.68% to 64.06% and Not know from 14.86% to 6.91%. Pearson gives , on 2 statistical degrees of freedom; the likelihood ratio gives , . Its printed 0.000 is rounding, not an exact zero. Both indicate nominal evidence against independence, although the Pearson value is just above 0.001 rather than below it. The minimum expected count is about 6.612. V and generalized phi are about 0.218, and the contingency coefficient about 0.213. The ordered-label gamma is about 0.500, Somers' D 0.239, tau-b 0.211 and tau-c 0.181. Neither direction of lambda improves modal prediction: No remains the modal response in both rows and Populist the modal group in each column. In particular, gamma 0.500 does not mean that populism explains half the variation in blocking.
For ages 35–44, reported blocking is versus , a difference of about 10.73 percentage points. No is nearly unchanged, 76.58% versus 76.32%, while Not know falls sharply from 14.41% to 3.95%. The full categorical association therefore includes a substantial awareness-category difference. Pearson gives , ; the likelihood ratio gives , , each on 2 statistical degrees of freedom. The minimum expected count is about 8.186. V and generalized phi are about 0.220 and the contingency coefficient about 0.215. Ordered-label gamma is 0.477, Somers' D 0.187, tau-b 0.200 and tau-c 0.165. Lambda for predicting the blocking category from populism is zero. In the reverse direction it is about 0.063: Not know has more Not-populist than Populist respondents, so allowing the response to change the predicted classification slightly reduces errors. This is a nominal prediction result, not a causal mechanism.
For ages 45–54, reported blocking is versus , only about 0.45 percentage points apart. No is 71.62% versus 78.38%, and Not know is 16.22% versus 9.01%. Here most of the descriptive distributional difference is between No and Not know rather than between the reported-Yes proportions. Pearson gives , ; the likelihood ratio gives , , with 2 statistical degrees of freedom. The minimum expected count is 8. V and generalized phi are about 0.101 and the contingency coefficient about 0.100. Ordered-label gamma is 0.164, Somers' D 0.067, tau-b 0.066 and tau-c 0.050; both lambdas are zero. A positive ordered-label coefficient therefore should not be substituted for a substantial difference in Yes rates.
For ages 55+, reported blocking is versus , a difference of about 3.02 percentage points. No is 87.78% versus 86.35%, and Not know is 6.67% versus 5.08%. Pearson gives , ; the likelihood ratio gives , , with 2 statistical degrees of freedom. V and generalized phi are about 0.053, with contingency coefficient about 0.053. One of six expected counts is below five, with minimum about 4.889. This is a mild sparse-cell qualification rather than a missing observation; an exact conditional test or fixed-margin Monte Carlo test could check calibration if needed. No simulated p-value is claimed. Ordered-label gamma is 0.184, Somers' D 0.043, tau-b 0.052 and tau-c 0.030, with both lambdas zero.
The Goodman and Kruskal's gamma, Somers' D, Kendall's tau-b and Stuart's tau-c values differ because their denominators handle ties or table dimensions differently. All the supplied pair partitions and numerical values agree with the counts. Their substantive ordinal interpretation remains limited by Not know. In contrast, Cramér's V and Goodman and Kruskal's lambda permit nominal categories; zero lambda means no improvement in modal classification, not absence of all association.[ref]
DescTools documentation for gamma, Somers' D and lambda. Details: ordinal-scale assumptions for gamma and Somers' D, versus nominal modal prediction for lambda
[ref]Ordinal association measures in the DescTools documentation. KendallTauB and StuartTauC: different tie and table-size conventions
Reported blocking within age and populism groups, with count-derived age-specific and standardized percentage-point contrasts; Not know remains a valid response
. Details. Holding age fixed does not eliminate the positive descriptive difference in reported Yes rates: none of the five differences reverses sign. Thus the evidence does not show a Simpson's paradox in which every conditional direction opposes the pooled direction. There is also little evidence for a single common magnitude from inspection: differences range from about 0.45 to 19.57 points. The elaboration model provides a useful language of persistence and possible specification, but these tables alone do not establish causal explanation or population effect heterogeneity.
As a clearly defined descriptive adjustment, use the complete-case age shares as common weights for both groups. Standardization with common weights gives reported-Yes proportions about 10.70% for Not-populist and 18.75% for Populist respondents, a difference of 8.04 percentage points, compared with the crude 7.26-point difference. Equalizing that age composition therefore does not explain away the observed contrast. It is not a causal effect, and its target remains the observed complete-case sample.
There is also nominal combined evidence against conditional independence. The joint conditional independence test for stratified contingency tables sums the five Pearson statistics to about 37.0169; under the usual independent-stratum asymptotic model this has 10 statistical degrees of freedom and . This derived test addresses whether all five full response distributions are conditionally independent, not whether their effects are equal or whether Yes alone differs in every stratum. A direct interaction contrast or appropriate categorical-response model is needed to test effect differences on a specified scale. Multiple separate tests additionally create a multiple testing issue if used selectively. The warranted conclusion is a persistent positive descriptive Yes association after age stratification, strongest at 25–34, with formal heterogeneity, missing-data and causal questions still requiring explicit assumptions and targeted analysis.
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 stratum | Difference: very safe | Difference: unsafe | Reported Pearson's chi-squared test p-value | Cramér's V | Goodman 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 .
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]
The Difference Between Significant and Not Significant is not Itself Statistically Significant by Andrew Gelman and Hal Stern. Printed p. 328, Introduction: comparing significance labels does not test the difference between estimates
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 givesUnder 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.
Past exam of the mathematics course of the University of Cambridge 2006 iii Paper 41 2 Solution Created 2026-10-03 Updated 2026-10-14
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 modelThe 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 givesThere 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 asThus 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 givesAlternatively, 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.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 37 2 Solution Created 2026-10-03 Updated 2026-10-07
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 iswith 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.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 35 4 f iii Solution Created 2026-10-03 Updated 2026-10-07
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 givesThe 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.


