Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 4 5J a Solution Created 2026-09-24 Updated 2026-10-05
This is the appropriate command for the full contingency table. It fits a log-linear model to the nine cell counts, with logarithmic link function and no interaction:With baseline constraints on , there are five parameters. The factorized means express independence of treatment group and damage category. The maximum-likelihood estimates areAlthough the experiment fixes each row total at 30, conditioning these independent Poisson random variables on those totals produces the appropriate row-wise multinomial distribution. The Poisson trick therefore gives the correct likelihood inference for this independence log-linear model for a two-way contingency table; the margins are nuisance parameters. It tests whether treatment changes the distribution of damage, rather than modelling a binary outcome.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 4 5J b Solution Created 2026-09-24 Updated 2026-10-05
This is not a valid ordinary R glm family specification. A multinomial distribution is natural for the three damage counts conditional on the row total, but base R's generalized linear model interface does not supply a family named multinomial. Furthermore, the written response is one cell count, not a three-category response or grouped multinomial vector. A properly specified multinomial logistic regression could model category probabilities by group, but it is not the model fit by this command. The independent-count log-linear model in part (a), conditional on the margins, is the appropriate supplied alternative.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 4 5J d Solution Created 2026-09-24 Updated 2026-10-05
The count weights correct the loss of frequencies for a deliberately coarsened binary response, but do not supply a third outcome category. Thus this remains inappropriate for the full contingency table. With the base R factor convention, it could fit the chosen first damage level versus the other two combined, using a logistic regression and the frequencies as weights. That is a different scientific question. The supplied log-linear model retains all three categories and their counts without this information loss.
Past exam of the mathematics course of the University of Cambridge 2021 ii Paper 1 13J a i Solution Created 2026-09-24 Updated 2026-09-25
Let be the count for treatment(Control, LD, or SD) and outcome(Better or Worse), and write . Both fits take the six cell counts to be independent Poisson variables.
The additive log-linear model fitted by
fit1 iswith reference constraints and . Thus treatment changes the overall group count but not the relative frequencies of the two outcomes. Past exam of the mathematics course of the University of Cambridge 2026 ii Paper 1 13K c Solution Created 2026-09-24 Updated 2026-09-25
In the log-linear model fit1 has only three main effects, so its fitted mean factors into a species factor, a diameter factor, and a height factor: mutual independence. Fit2 adds the species-diameter interaction, allowing those variables to associate, while asserting .
The likelihood-ratio deviance drop on one degree of freedom has , strong evidence against species-diameter independence. Test fit2's remaining independence claim by comparing it with a model adding both Species:Height and Diameter:Height interactions (equivalently compare fit2 with the saturated model); its residual deviance is assessed against .