Past exam of the mathematics course of the University of Cambridge 2009 ii Paper 1 5I Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2010 ii Paper 1 5J Solution Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 206 4 b Solution Created 2026-10-03 Updated 2026-10-06
For independent patients, the Bernoulli logistic-regression model iswhere with nonfrail patients as the reference level in a regression factor. The fitted linear predictor isThe null model fits one intercept, so its 99 residual degrees of freedom imply 100 patients; the full model's confirms this. Unit weights correspond to individual binary responses, not grouped binomial counts.
The Akaike information criterion estimates expected relative out-of-sample discrepancy, using the maximized log-likelihood plus a complexity penalty:Here , since the Bernoulli dispersion is fixed at one. The saturated model puts probability one on each observed binary outcome and has log likelihood zero, so the binomial deviance is . ConsequentlyThere is no estimated error-variance parameter to count. The printed name “Aikake” should be read as Akaike.
Past exam of the mathematics course of the University of Cambridge 2022 iii Paper 218 3 a Solution 2026-09-28
For word-count vector , the fitted logistic model isHolding other counts fixed, one additional occurrence of "dollar" multiplies the fitted spam odds by .
The logistic classifier isThe coefficients maximize the Bernoulli logistic-regression model likelihood over the training emails.
Past exam of the mathematics course of the University of Cambridge 2022 ii Paper 1 13J b Solution Created 2026-09-24 Updated 2026-09-25
The code fits a Bernoulli logistic-regression model. Conditionally on the covariates, the responses are independent withwhere the design includes the displayed numerical predictors and indicator columns for factor levels. It maximizesAkaike information criterion iswhere is the number of fitted parameters. Backward stepwise selection starts from the full model, tentatively removes each eligible term, chooses the removal producing the lowest AIC, and repeats while AIC decreases. It balances fit against model size rather than testing every coefficient at a fixed significance threshold.
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 2 5J Solution Created 2026-09-23 Updated 2026-09-25
The commands choose observations and predictors; generate a matrix of independent standard-normal values; generate independent binary random variables with success probability ; and report the observed number of successes, . The first
glm call then fits the Bernoulli logistic-regression modelThe prediction command returns the fitted response probabilities and sums them.The likelihood isAt the maximum-likelihood estimator, the intercept component of the score function isThereforeexactly, by the fitted-mean balance for logistic regression with an intercept.
The second fit uses probit regression,where is the standard normal distribution function. Its intercept score isa weighted residual equation. It does not imply , so exact equality is not expected. The output should nevertheless be close to : the data were generated with constant success probability independently of , so the fitted slopes should be small, the linear predictors should cluster near a common intercept, and the score weights should be nearly constant.