Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 41 1 Solution Created 2026-10-03 Updated 2026-10-14
scan reads the numerical prices, including the three missing-value markers, into a vector. The data must be read row by row for the subsequent factor construction to match them. The sample size available for analysis is therefore , rather than . The numerical summary describes the observed prices: the sample median is £43.54 and the sample mean is £46.94. The upper tail, particularly the boots, raises the sample mean above the sample median. These summaries mix very different products and are not adjusted country comparisons.The two character scans create labels.
gl(8,5,length=40,labels=item) makes a regression factor with each of eight item labels repeated five times. gl(5,1,length=40,labels=country) cycles through the five country labels once for each item. For a regression factor and numerical response, the two plot commands produce grouped box plots. The country box plots suggest lower US prices, while the item box plots show particularly expensive boots and inexpensive cardigans. They are descriptive displays of this small basket, with different item compositions where prices are missing; they cannot separate country effects from item effects.The first
lm fits an additive two-way analysis of variance:The constraints are R's usual treatment coding. The normal linear model used for the printed tests assumes independent errors with common variance and approximately a normal distribution, and no item-by-country interaction in the mean. Missing prices are omitted, leaving responses and independent mean coefficients. Thus the residual degrees of freedom are . This deletion is defensible for the conditional price model when missingness does not depend on the unobserved error after conditioning on the two factors; the output itself does not establish such a missing-data mechanism.The
anova tables report sequential sums of squares, rather than order-independent adjusted effects. If are the residual sums of squares from the intercept-only, country-only, item-only and additive fits, the first order allocates to country and to item. The second order allocates to item and to country. Both allocations sum to the same total explained sum of squares, and both end with the same residual sum of squares . The three missing combinations destroy balanced factorial orthogonality, so the allocation changes with order. To test country after allowing for items, use the country row in the second table; to test item after allowing for countries, use the item row in the first table. The first-entered rows do not supply those adjusted tests.Each mean square in ANOVA divides its sum of squares in ANOVA by its statistical degrees of freedom, and each printed F-statistic divides that mean square in ANOVA by . In particular, the adjusted country partial F-test haswith an reference F-distribution and p-value approximately . The adjusted item partial F-test gives on statistical degrees of freedom. Both factors contribute strongly under the additive normal linear model. The larger item sum of squares in ANOVA measures the much greater differences between these products, but is not evidence that every pair of items differs significantly.
The intercept is the fitted UK price for the reference jeans, not their observed price and not the overall sample mean. Each country regression coefficient is its adjusted price difference from the UK, assumed common across items: Sweden is £5.224 lower, France £10.708 lower, Germany £7.676 lower and the US £21.328 lower. Each item regression coefficient is its adjusted difference from the reference jeans, assumed common across countries. Thus the fitted UK boots price is , and the fitted US boots price is .
The coefficient standard errors come from , where and is the design matrix. Dividing each estimate by its standard error gives the displayed Student t-test statistic, with statistical degrees of freedom. The stars summarize the corresponding two-sided p-values. The individual tests compare each indicated country or item with its reference level, conditional on all other additive terms; they are neither tests of every pairwise comparison nor a simultaneous confidence interval procedure. In particular, Sweden's p-value provides weaker evidence than the other country contrasts, and does not establish equality with the UK. The intercept test has little substantive relevance, and interpreting many individual stars also raises multiple hypothesis testing issues.
The residual standard error measures unexplained prices in pounds. With total corrected sum of squares , the coefficient of determination and adjusted coefficient of determination areMuch of this impressive fit is due to the large differences between items. The overall F-test compares the additive fit with a constant mean: on statistical degrees of freedom. It tests that all eleven non-intercept coefficients vanish, not that the additive model is adequate. Regression diagnostics should examine regression residuals, changing price variability across items and possible interaction. Percentage differences may be more plausible than common pound differences, motivating a natural logarithm of price. No random sample of countries or products, and no independent replication of a price within a cell, is supplied; broad claims about all designer goods or the causes of country differences require more than these conditional tests.
Finally,
Item*Country expands to both main effects and their full interaction. A cell-means parameterization has one separate fitted mean for every observed cell. With one response per cell its design matrix has row matrix rank , while the full layout nominally has coefficients. Three coefficient combinations are aliased because their cells are missing. This is saturation of an unreplicated two-factor regression: every observed price is fitted exactly and the residual degrees of freedom are zero. The final fit has zero residuals, and no residual-based estimate of the error variance or ordinary interaction significance test. The printed numerical summary will mark three coefficients unestimable; coefficient standard errors, tests and adjusted involve undefined division by zero, potentially appearing as NaN or Inf according to numerical roundoff. Perfect interpolation here is a consequence of a saturated statistical model, not evidence for a superior predictive model. 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 2008 iii Paper 41 2 iii Solution 2026-10-14
By balanced factorial orthogonality, omitting B adds to the full additive residual: . This model has parameters and residual degrees of freedom.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 41 2 iv Solution 2026-10-14
By balanced factorial orthogonality, omitting A adds to the additive residual: . This model has parameters and residual degrees of freedom.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 41 2 Solution 2026-10-14
Let , and . The proposed least-squares estimators satisfy the sum-to-zero constraints because and . Define . Direct summation givesNow write any other admissible parameters as , , , where . Expanding the ordinary least squares criterion, the cross-products with vanish by the preceding identities. The cross-products between , and vanish by their zero sums. ConsequentlyEvery added term is nonnegative and all vanish only at , . This proves the unique constrained minimum, withThe additive-model residual sum of squares and intercept-only residual sum of squares are thereforeThe same orthogonality gives the analysis of variance identityFitting factor B alone yields fitted values and residual sum . Fitting A alone gives residual sum . Adding B after A then reduces it to , a reduction of again. The reduction due to B is in either order. This is balanced factorial orthogonality; it generally fails for unequal cell replication.
There are observations. The additive model estimates independent parameters, so the missing degrees of freedom are A: 2, B: 1, residuals: 8. The individual requested residual sums are below.
To check for an interaction, extend the normal linear model to , with each row and column sum of zero. Equivalently, fit the six unrestricted cell means. Its residual sum of squares is the within-cell sumThe interaction adds parameters; the cell-means residual has degrees of freedom. Under the no-interaction null hypothesis and the independent equal-variance normal error model,The numerator and denominator arise from orthogonal Gaussian projections, proving the exact F-test. Reject for a sufficiently large value. The printed additive analysis of variance table does not supply , so it cannot determine this test statistic numerically; the replicated cell data would do so.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 30 2 e Solution Created 2026-10-03 Updated 2026-10-07
The analysis of variance provides evidence of a chocolate effect both with day included (, p-value ) and with day omitted (, p-value ). Because every chocolate–day cell has the same replication, balanced factorial orthogonality separates the two main effects; the chocolate row is meaningful despite being entered first.
The chocolate-only fitted group means are approximately boards for A, B, C, D respectively. Thus A has the largest fitted lecturing speed and C the smallest. Relative to A, the fitted differences are boards. The printed individual Student t-tests give strong evidence for the A–C contrast (p-value ); B and D versus A have p-values and , respectively. Those latter contrasts are not significant at 5%, and the output does not test all other pairwise comparisons. Simultaneous claims would require accounting for multiple hypothesis testing.
There is little evidence of a day effect after adjusting for chocolate. A chocolate-only normal linear model is therefore a reasonable simpler summary, with residual standard deviation about boards and explained variation . This is an association under the additive statistical model; a causal claim would additionally require an appropriate assignment of chocolate and checks of the regression residuals and possible interaction terms.
