Deviance goodness-of-fit test 2026-10-06
For a suitably regular generalized linear model, a residual deviance can be compared approximately with a chi-squared distribution on degrees of freedom to assess fit relative to the saturated model. Sparse or very small expected cell counts can invalidate this reference distribution. A large p-value means no detected lack of fit, not proof of correctness; dependence, wrong mean structure or overdispersion still require diagnostics.
For known size , the negative binomial distribution is an exponential family with natural parameter and cumulant . A generalized linear model can use a logarithmic link function for its mean, even though that link is not canonical. Jointly estimating the size changes the family and variance function, requiring additional updates beyond a single fixed-family GLM fit; this is what
MASS::glm.nb does. Generalized linear mixed model Created 2026-09-24 Updated 2026-09-24
A generalized linear mixed model adds latent random effects to the linear predictor of a generalized linear model.
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 1 5I Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 2 5I Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 1 13I Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 3 5I Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2007 ii Paper 3 5I Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2011 ii Paper 3 5J Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 37 3 a Solution Created 2026-10-03 Updated 2026-10-07
Index independent experimental vials by , write for the observed total eaten and for the number of other-species eggs eaten. The grouped-binomial logistic regression usesHere and identify day and adult species, and the free effects are . There is no day-species interaction. The weights in the binomial generalized linear model are the denominators , so fitting the proportions gives this binomial likelihood, not 23 Bernoulli observations. The dispersion is fixed at one. This is a model for the composition of eggs eaten conditional on the total, rather than a model for the total appetite.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 37 3 b Solution Created 2026-10-03 Updated 2026-10-07
There are 23 independent vial responses. The intercept-only fit has 22 residual statistical degrees of freedom and deviance 33.631. Adding two day indicators removes two statistical degrees of freedom and reduces the residual deviance by . Adding the two species indicators then reduces it by . Thus the six replacements, in their printed order, are .
The residual deviance statistical degrees of freedom are , , and . These sequential analysis-of-deviance rows compare nested generalized linear models in the displayed order. In an unbalanced design, the first day row does not test day after controlling for species.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 37 4 a Solution Created 2026-10-03 Updated 2026-10-07
For the Poisson regression, the log-likelihood isSince , the score function and its derivative areConsequently a finite maximum-likelihood estimator satisfiesThese nonlinear equations are normally solved by iteratively reweighted least squares. If has full column rank, the Hessian is negative definite and any finite solution is the unique maximizer. Full rank does not by itself rule out a boundary solution at infinite coefficients for every conceivable data set. The Poisson generalized linear model has dispersion one, so there is no separate scale parameter in this likelihood.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 33 3 b Solution Created 2026-10-03 Updated 2026-10-06
A generalized linear model specifies independent responses in an exponential dispersion family, their means , and a link function connecting those means to a linear predictor. In the common notation,where are known positive weights, is the common dispersion parameter, and is the variance function. The systematic part isHere is a row of the known design matrix and contains the unknown regression coefficients. The link function is invertible on the permitted mean domain; the canonical link function takes the mean to the natural parameter. This separates distributional, predictor, and link assumptions: it does not require the response itself to be normally distributed or the mean itself to be linear in the covariates.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 1 10J Solution Created 2026-09-24 Updated 2026-10-06
The Poisson regression uses independent counts with mean and logarithmic link function. Writing for concentration, the fitted predictors for strains are respectivelyThe interaction formula includes concentration, strain indicators and their products. The intercept is the baseline log mean at zero toxin; exponentiating it gives about fleas. Strain coefficients compare log means at zero concentration. Interaction coefficients compare concentration slopes with the common strain. A unit concentration increase multiplies the three means by about , and respectively.
For design matrix , the fitted expected Fisher information is , , since a Poisson count has variance equal to its mean. Standard errors are square roots of diagonal entries of . Each reported Wald test divides its coefficient estimate by its standard error and compares with an approximate standard normal distribution under a zero-coefficient null, conditional on the other terms. Concentration has strong evidence of a negative baseline effect. At zero concentration strain 1 is not significant at 5% (), while strain 2 is (). The strain-1 slope differs strongly from the baseline (); the strain-2 slope has no detected difference (). A nonsignificant difference is not proof of equality. The very significant intercept is a test of mean one at zero toxin, with little scientific relevance.
Relabelling factor levels merges strains 0 and 2 into one group and leaves strain 1 separate. Model retains three intercepts but allows only two slopes: strain 1 versus the common slope of strains 0 and 2. Thus it has five parameters, compared with six in . Model merges both intercepts and slopes for strains 0 and 2, retaining only four parameters. The natural nesting is .
For these nested generalized linear models, the difference in Poisson deviance is an asymptotic likelihood-ratio test statistic with degrees of freedom equal to the parameter difference. Comparing with gives on one degree of freedom, far below : the additional strain-2 slope is unnecessary. Comparing with gives on one degree of freedom, far above : merging the strain-0 and strain-2 intercepts is rejected. Comparing with uses on two degrees of freedom and requires a two-degree-of-freedom threshold, about , rather than the supplied .
is the most appropriate of the three models: retain different strain baselines and the special strain-1 slope, but pool the unsupported strain-2 slope difference. Residual degrees of freedom are ; deviances of this magnitude give no obvious evidence of overdispersion from these summaries alone.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 4 4J Solution Created 2026-09-24 Updated 2026-10-06
This is a generalized linear model with independent Bernoulli distributions for the responses and the logit link. Under treatment coding with colour one as the reference level, the linear predictor isColour is a categorical variable, not a numerical trend. Width has the same slope for every colour, since no interaction term is fitted. The parameters are estimated by maximum likelihood estimation.
The approximate Wald confidence interval for the width coefficient is , or approximately . This uses the approximate normal distribution of the maximum-likelihood estimator, rather than a confidence interval for an individual binary response.
For the requested crab, the fitted linear predictor is . Applying the inverse logit link gives . The rounded displayed coefficients need not reproduce the reported test statistics exactly.