Logistic function 2026-10-06
The standard logistic function maps a log odds to probability . More generally, its translated and scaled form is .
Logit 2026-10-14
The logit link maps a mean probability to its log odds: , . Its inverse is , used in logistic regression.
Include an intercept and let be the chosen numerical feature vector. Logistic regression usesThe logistic function maps every real score into , allowing a Bernoulli distribution model for the label. Equivalently, the log odds are linear in the features:This gives a smooth differentiable probability model with a linear decision boundary at any fixed probability threshold. The sigmoid output is a fitted conditional probability, not a categorical prediction until a threshold is chosen.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 38 3 b Solution Created 2026-10-03 Updated 2026-10-14
The first fit is a Bernoulli logistic-regression model for the probability of a positive response. Its fitted linear predictor isand its fitted probability is . There are eight coefficients. The null degrees of freedom identify , and the residual degrees of freedom are .
Each slope is a change in the log odds per unit of its covariate, holding the others fixed. Exponentiating gives conditional odds ratios; for example a ten-unit glucose increase multiplies fitted odds by , and a ten-year age increase by . These are changes in odds, not multiplicative changes in probability, and the observational associations are not automatically causal effects. The intercept corresponds to all numerical covariates being zero, generally an extrapolation beyond meaningful subjects.
The standard errors come from the inverse Fisher information matrix of the logistic regression. With binomial dispersion parameter fixed at one, the displayed t ratios are asymptotic normal Wald statistics. In the full fit, glucose and the pedigree measure have clear individual evidence of nonzero slopes, with two-sided and . The body-mass and age terms are borderline, with and ; pregnancy count is weaker, . Blood pressure and skinfold have little individual evidence after adjustment. These labels should not be converted into a claim that the weaker predictors have no effect, or used as automatic model-selection rules.
A deviance residual here isIts square is the observation's contribution to binomial deviance, so the squared residuals sum to the printed residual deviance. The five-number summaries describe the distribution of these signed residuals. The null deviance belongs to an intercept-only logistic regression; the full fitted deviance is . Four Fisher scoring iterations record convergence of the numerical likelihood fit.
The second model uses only glucose:Its two coefficients leave residual degrees of freedom. A ten-unit glucose increase multiplies its fitted odds by . This differs from the adjusted multiplier , because the models condition on different covariates; both adjustment and noncollapsibility of the odds ratio can change logistic coefficients. The glucose-only model has deviance , so its maximized log-likelihood is lower than the full model's.
For these fixed-dimensional nested models, analysis of deviance and Wilks theorem giveThus the additional six predictors collectively improve the glucose-only model, even though several individual Wald tests are not significant. These comparisons assume independent subjects, an appropriate logistic mean structure, full rank, and regular finite parameter estimates without separation.
It would be incorrect to infer that absolute fit is good merely because . Individual Bernoulli deviance need not have a chi-squared calibration: there is just one binary observation per saturated probability, and the saturated dimension increases with sample size. A simple counterexample is an intercept-only model with true probability , for which , not one. For absolute adequacy, inspect residual patterns and predicted-risk calibration, use meaningful grouped comparisons when appropriate, or calibrate a chosen fit statistic by parametric bootstrap. The regular nested-model tests above are not subject to that saturated-model dimensionality problem. Only the displayed summaries and a few example rows are supplied, so patient-level diagnostics or complete numerical refitting cannot be reconstructed from this page alone.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 38 5 iii Solution Created 2026-10-03 Updated 2026-10-14
The population-averaged logistic regression describes after averaging over unmeasured individual heterogeneity. Its intercept is a marginal log odds at reference baseline values and time zero, its treatment coefficient is a population conditional-on-baseline log odds ratio, and its time coefficient is the change in that marginal log odds per month. Time zero is an extrapolation here because the recorded visits begin later; centring time at the first visit would give a more interpretable intercept.
In the random-intercept logistic model, the intercept is instead the conditional log odds for a subject with . The treatment and time coefficients apply at fixed ; the subject's actual intercept is . Even with a treatment-independent random intercept, the conditional and marginal coefficients generally differ through noncollapsibility of the odds ratio. Indeed, if , marginalization giveswhich is not generally a logistic curve with the same linear coefficients. To quantify random-intercept attenuation of marginal logistic slopes, let . ThenFor a nondegenerate finite random intercept this derivative lies strictly between zero and one and usually varies with . Thus the marginal treatment contrast is an integrated, attenuated version of the conditional contrast, and the marginal time slope need not be constant. One should not equate the two sets of coefficients, even in a randomized controlled trial without treatment confounding.
For missing completely at random, an unweighted observed-response GEE with cluster-robust standard errors can consistently fit the marginal mean, and a correctly specified integrated GLMM likelihood is valid as well. Under missing at random depending on previous observed outcomes, ordinary unweighted GEE is generally biased because the remaining responses are selected by informative observed history. Correct inverse-observation-weighted estimating equations for longitudinal dropout recover the marginal target under the sequential MAR and positivity assumptions already stated. Covariate-only observation mechanisms are a simpler special case in which correctly conditioned unweighted mean equations can remain valid.
A correctly specified joint response GLMM, fitted by observed-data likelihood, is valid under ignorable missing at random with distinct parameters, including dependence of missingness on observed response history. This is a likelihood property, not a claim that every mixed model automatically fixes missingness. Under missing not at random, neither ordinary GEE, MAR-based weights nor a response-only GLMM is generally valid; the unseen-outcome dependence requires further modelling and sensitivity assumptions.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 38 5 iv Solution Created 2026-10-03 Updated 2026-10-14
First investigate what predicts dropout among variables actually observed, record reasons where possible, and seek additional outcome follow-up. Dependence on observed history alone can be missing at random; informative dependence on unseen responses or latent heterogeneity requires a missing not at random analysis. Observed data do not ordinarily distinguish MAR from all MNAR explanations.
An explicit selection model for informative longitudinal dropout can augment a joint response model by dropout hazards. Define as above and, among subjects retained through visit , putOmit the previous-response term at the first visit. A nonzero makes dropout depend on the currently missing response. For monotone observation indicators , letThe appropriate observed-data likelihood isThus a patient's dropout pattern contributes information in the model; dropping the factor is not justified under this informative mechanism.
Another option is a shared-parameter model for informative dropout: retain the conditional Bernoulli response model, but let the dropout logit contain the same latent effect, for example . Conditional on the shared effect and observed history the processes can be independent, while marginally dropout remains associated with unseen responses. The joint likelihood must integrate the response factors and dropout factors together over . A response-only mixed-model fit does not generally account for this dependence.
Because or can be weakly identified from the observed outcomes, report sensitivity of the treatment conclusion to plausible informative-dropout assumptions. One can fix a range of these dependence parameters and refit, or use pattern-mixture sensitivity analysis that shifts the imputed post-dropout log odds by a specified amount from the MAR prediction. Present population risks and treatment contrasts across these scenarios with their uncertainty. These are explicit identifying assumptions, not an empirical test proving which missingness mechanism is true. Neither a complete-case analysis nor carrying forward the last response supplies such a justification.
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 4 5I Solution Created 2026-09-24 Updated 2026-10-14
The first two commands create vectors of observed successes and corresponding numbers of trials. The next two create the class labels and convert them into an R factor, so the labels are treated categorically. The final command fits a grouped-binomial logistic regression, using the proportions as responses and trial totals as binomial weights, and prints its summary. The model is , with class a as reference.
The intercept estimates the log odds in class a. Its value corresponds to probability . The class-b coefficient is the estimated increase in log odds, about , so the fitted probability in class b is and the estimated odds ratio is . The printed standard errors measure uncertainty in these estimated coefficients. The z values are estimate divided by standard error: the intercept tests whether the class-a probability is , while the class-b z value tests equal class probabilities. The two-sided normal-reference P-value for the latter is about , so it is just above a conventional threshold; this is a borderline result rather than strong evidence of a class effect.
The residual deviance compares the fitted two-parameter model with the four-probability saturated model. Its value on residual degrees of freedom is small relative to a reference, with approximate tail probability . There is no evidence of lack of fit by that check. Four Fisher scoring iterations were needed for numerical fitting. These interpretations presume independent binomial counts and the usual large-sample approximations; weights here encode trial counts, not extra independent observations.
Past exam of the mathematics course of the University of Cambridge 2006 iii Paper 41 4 Solution Created 2026-10-03 Updated 2026-10-14
For independent binomial distributions, the log-likelihood, up to known binomial coefficients, isThe saturated statistical model maximizes each term at . Under the logit link, the fitted probabilities are . Subtracting the fitted log-likelihood from the saturated log-likelihood gives the binomial devianceA zero-count summand uses the continuous convention . For the restricted model, replace by to obtain . Since the saturated likelihood cancels, is the likelihood-ratio test statistic. For the nested restriction setting coefficients to zero, Wilks theorem gives the asymptotic chi-squared distribution under regularity and an interior true parameter; reject for a large difference.
For the six anther cells, gives a common success probability, gives a separate probability for each storage condition, gives a common intercept and a log-force slope, and gives storage-specific intercepts with a common log-force slope. Their parameter counts are , so their residual statistical degrees of freedom are . In , storage has a constant effect on log odds; multiplying force by multiplies the odds by in either storage group.
The relevant nested likelihood-ratio tests at the level are:
- Adding storage to gives on one statistical degree of freedom, with .
- Adding log-force to gives on one statistical degree of freedom, with .
- Adding log-force to the storage model gives on one statistical degree of freedom, with .
- Adding storage to the log-force model gives on one statistical degree of freedom, with .
- Adding both terms to gives on two statistical degrees of freedom, with .
The two two-parameter models and are not nested, so their deviance difference has no ordinary nested chi-squared distribution calibration. The preferred parsimonious model is , with a storage effect and no log-force effect. Its deviance goodness-of-fit test is acceptable: on four statistical degrees of freedom. The common-probability model also passes its separate goodness-of-fit comparison, , but this does not contradict the relative evidence for adding storage: the two tests assess different null hypotheses. These are large-sample approximations; sufficiently large expected successes and failures, not merely the number of anthers, underpin their calibration.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 38 3 Solution Created 2026-10-03 Updated 2026-10-14
Let be the disease count among miners in exposure group , with representative exposure , for . The grouped-binomial logistic regression isThe model assumes independent miners, a common disease probability within each group at its representative exposure, and binomial variation without an extra dispersion parameter. The use of average exposure is a grouping approximation, not a claim that every miner in a group has identical exposure. The input response is and
weights=miners supplies the binomial denominators , not inverse variances; together they yield this count likelihood function. The default binomial link is the logit link.For , the likelihood-ratio test compares the intercept-only model with the linear-exposure model. The reduction in binomial deviance isUnder the usual regular large-sample approximation it has a chi-squared distribution with one degree of freedom. There is very strong evidence of exposure dependence, with a positive estimated coefficient .
For goodness of fit against separate probabilities in all eight groups, the residual binomial deviance has approximately degrees of freedom. Its upper-tail probability is about , giving no evidence of lack of fit. This is an approximate check, particularly because the earliest exposure groups have small expected disease counts. It supports adequacy of this mean structure, not proof that all its assumptions or possible confounding variables have been addressed.
The
predict call asks for a prediction at exposure , sets type="response" to return the fitted probability rather than its log odds, and requests the standard error of that fitted probability. It givesFor , the linear predictor is , and the delta method givesThe intercept-slope covariance is included in this expression. This measures uncertainty in the fitted mean probability; it is not the standard deviation of a new individual's binary disease outcome or of an unspecified new sample proportion.The model's odds at exposure are . Hence , independently of . By invariance of maximum likelihood estimation, estimate this odds ratio by . A Wald confidence interval for is ; exponentiating its endpoints after multiplication by gives the interval for the multiplier. Using the printed coefficient and standard error yieldsThus the estimated odds rise by about per year, or by a factor about per decade. These are changes in odds, not fixed multiplicative changes in probabilities.
The second fit keeps the same independent binomial distributions but permits a quadratic linear predictor,In the sequential analysis, each exposure term adds one coefficient. With the first model's deviances, all nine missing entries are recovered in this completed table:The final reduction is , with rounding to the precision of the printed output. Testing therefore gives on one degree of freedom. At the significance level I would retain the simpler linear-exposure model: it already fits adequately and the extra curvature is not clearly established. The quadratic fit does improve the likelihood somewhat; its Akaike information criterion is about smaller, since . Thus different reasonable selection criteria may weakly prefer different models, but these data do not give strong evidence that the additional term is necessary.
Past exam of the mathematics course of the University of Cambridge 2010 iii Paper 34 1 c Solution Created 2026-10-03 Updated 2026-10-14
Write the logistic regression aswhere denotes elective exposure and contains the measured background predictors. At fixed , changing from zero to one changes the log odds by , so the adjusted odds ratio is . If is the estimated coefficient covariance matrix, thenUse the clinic-cluster sandwich covariance matrix if that is how within-clinic dependence is allowed for. The interval is first calculated on the coefficient scale and then exponentiated; one does not add and subtract a standard error directly from the odds ratio. This is a large-sample Wald confidence interval; profile-likelihood limits are another option when the likelihood shape warrants them. If exposure interacts with background variables, there is no single common conditional odds ratio: its logarithm includes the corresponding interaction terms.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 37 3 d Solution Created 2026-10-03 Updated 2026-10-07
In the species-only model, the log odds for adult species A is the intercept, so with standard error 0.07824. This also follows directly by pooling its vials: there are 570 other-species eggs among 799 eggs eaten, giving andFor a regular maximum-likelihood estimator, asymptotic normality of a maximum likelihood estimator gives , with information . Substitution of gives . An approximate 95% Wald confidence interval isThis interval treats the selected species-only model as fixed; it does not account separately for uncertainty from choosing that model.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 37 3 e Solution Created 2026-10-03 Updated 2026-10-07
The relevant no-preference benchmark is , because two of the three equally supplied egg types count as other-species eggs. Its log odds is , which is below the entire confidence interval. Under the fitted binomial model, species A preferentially consumes other-species eggs. The estimate is , and transforming the log-odds confidence interval by gives approximately .
Comparing the interval with zero would test equal numbers of own- and other-species eggs eaten, which is not the no-preference hypothesis for this supply. The conclusion remains model-dependent: eggs are taken from a finite supply without replacement, and depletion or dependence within a vial can affect the binomial approximation. This fitted analysis supports an association with egg type; it does not by itself establish the mechanism of recognition or avoidance.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 35 4 a Solution Created 2026-10-03 Updated 2026-10-06
The log odds ratio for treatment relative to control is the difference of the two log odds:Thus the treatment-to-control odds ratio is . Its direction refers to whatever event the binomial count records.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 35 4 b Solution Created 2026-10-03 Updated 2026-10-06
The intercept is the midpoint of the two log odds:Equivalently is the geometric mean of the two odds. The logistic function evaluated at represents a central event probability, and approximates the average of the two group probabilities when is small. It is not generally their arithmetic average, nor is specifically the control-group log odds.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 35 1 e Solution Created 2026-10-03 Updated 2026-10-06
Ordinary multiple imputation by chained equations relies on missing at random, conditional on the variables included in its models, together with adequate model specification and suitable conditional distributions. For Bayesian inference that ignores the response mechanism, the usual sufficient condition also includes distinct parameters for data and missingness models, with an appropriately separate prior.
The suspected dependence on withheld responses makes the usual missing-at-random assumption doubtful. An accurately fitted observed-data model cannot, on its own, establish what the nonresponders would have reported. Use substantive judgement and sensitivity analysis under plausible missing not at random departures, for example a pattern-mixture sensitivity analysis shifting the imputed condom log odds or partner-count distribution relative to the observed-data prediction. Report how the final association changes. Additional informative measurements may make missing at random more credible, but cannot verify it.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 6 i c Solution Created 2026-10-03 Updated 2026-10-06
For , put and . Removing all factors independent of from the posterior distribution gives, for ,A stable implementation uses the difference of the log weights. The conditional log odds areso , a logistic function. For very large , evaluate this logistic expression using the sign of to avoid exponential overflow.
For Gibbs sampling for a finite hidden spin field, initialize any spin configuration. At every step choose uniformly, draw a fresh uniform variable, set spin to with the probability above and to otherwise, and leave all remaining spins fixed. This Random-scan Gibbs sampler has the stated posterior distribution invariant by detailed balance of a random-scan Gibbs sampler. All conditional probabilities are strictly between zero and one. For the one-site case, the conditional probabilities are both .
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 206 4 a Solution Created 2026-10-03 Updated 2026-10-06
For , the Bernoulli distribution has massIn exponential dispersion family notation , takeThe support is ; outside it the probability is zero. The natural parameter of an exponential family is the log odds, and the dispersion parameter is fixed rather than freely estimated. Differentiating the cumulant givesAt or the degenerate distributions are limiting boundary cases with natural parameter or .
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 206 4 d Solution Created 2026-10-03 Updated 2026-10-06
The proposed generalized additive model retains the binary response and logit link, but replaces the linear age effect by a smooth function:A penalized cubic regression spline represents ; frailty remains a parametric coefficient. The plotted age smooth is centered, so its vertical values represent an age contribution to log odds, not probabilities or the entire fitted predictor.
The plot gives no evidence that the nonlinear model improves the mean structure. The fitted curve is essentially a straight descending line, and the label
s(age,1) reports effective degrees of freedom close to one, consistent with a linear effect. The widening bands near the ends reflect sparse data and increasing uncertainty, not detected curvature. A linear-age logistic regression is therefore adequate on this evidence and simpler to interpret. A formal comparative claim would need a suitable test or predictive/model-selection criterion, but the figure supplies no reason to retain extra nonlinear flexibility. Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 1 12J Solution Created 2026-09-24 Updated 2026-10-14
Under the binomial distribution model's assumption of independent games with a common win probability , the probability of winning a match isThis is also the cumulative distribution function of a beta distribution with parameters : differentiation of the binomial tail gives , and . In particular is strictly increasing on and maps bijectively onto itself.
The new match probability is , while the desired linear predictor remains the game-level log odds. Therefore the link function isIts endpoint values are and . This is not the ordinary match-level log odds link: it first recovers the underlying game probability. Symmetry of the binomial tail gives , hence , as required by swapping the players. Dependence or varying game probabilities within a match would invalidate the stated binomial-tail conversion.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 216 3 a Solution Created 2026-10-03 Updated 2026-10-05
Write , , and . We keep the model's printed coefficient literally. Its latent log odds can be writtenThe independence of the is conditional on : they are not marginally independent when the random effects are correlated.
Holding the other predictors and the random-effect realization fixed, increasing predictor by one shifts the latent log odds by , so it multiplies the conditional odds of a late departure by . For a binary snow indicator, this compares the snow and no-snow days with other predictors held fixed. This is a conditional odds ratio, not generally the same as a marginal odds ratio after integrating the random effects.
Randomizing allows unmeasured daily conditions to change the success probability beyond the systematic linear predictor. In this logistic-normal regression with autoregressive random effects, let and . The law of total variance givesso the mixture allows overdispersion beyond a binomial distribution with fixed probability. The correlated part also allows related outcomes on nearby days.
The stationary autoregressive process of order one has and . HenceThe term is unstructured daily variability, whereas is the temporally correlated component under the printed parameterization. Larger gives greater persistence: the lag- correlation of the latent log odds is .
The PDF itself prints both the coefficient and the requested combination . They are inconsistent as a marginal variance. If the intended coefficient were , the variance and off-diagonal covariance would instead be and . The prior's argument list also repeats ; its displayed density indicates the intended second variance parameter is .
There is a further substantive issue with that improper prior. After integrating the latent variables, the observed-data likelihood function is positive and continuous at for fixed finite , positive , and . On a compact positive-volume set of those parameters it therefore has a positive lower bound for small . The prior density is , so integrating over gives . Thus the stated joint posterior distribution is improper, an instance of improper posterior from a log-uniform random-effect scale prior. The requested fixed-parameter conditional laws below are nevertheless proper; their existence does not remedy the joint impropriety.