Box–Cox transformation Created 2026-09-29 Updated 2026-10-14
For , the Box–Cox transformation isThe value of can be selected by maximizing its profile likelihood; corresponds to an affine transformation of the original response, while gives a logarithmic transformation.
Past exam of the mathematics course of the University of Cambridge 2004 iii Paper 37 4 Solution Created 2026-10-03 Updated 2026-10-14
The commands read the 52 cell values into a vector and build the matching two-factor layout. In
expand.grid(country, goods) the first factor varies fastest, so the four countries are listed successively within each goods category. This matches row-by-row reading of the displayed table. Converting Goods to a factor is essential: its labels identify 13 categories and are not a quantitative trend. Country supplies the other categorical factor. The summaries suppress coefficient correlations, not coefficient standard errors.The first fit is the additive two-factor normal linear modelThere are free coefficients and residual statistical degrees of freedom. This is two-way analysis of variance without an interaction term. For this complete balanced layout, ordinary least squares givesThese formulas follow from the row- and column-sum normal equations: fitted row and column totals equal their observed totals. The balanced-design coefficient standard errors are for a goods contrast, for a country contrast, and for the reference-cell intercept. These yield the common contrast standard errors and the different intercept standard error in each summary. In particular the intercept is the fitted Software–UK value, not the grand mean or the observed Software–UK entry.
Thus the first intercept predicts million euros for Software in the UK. The Books coefficient adds million euros to the fitted value in any country, relative to Software; every other goods coefficient has this same arithmetic-difference interpretation. The country coefficients subtract , and million euros from the UK prediction for France, Germany and the rest of Europe respectively, regardless of goods. The model therefore assumes common absolute country differences across goods categories. For Software–France its prediction iswhich is impossible for positive spending and indicates a limitation of this additive original-scale specification.
The residual standard error is million euros, obtained from ; direct calculation gives . Each coefficient's printed statistic is , with a reference distribution under this normal linear model. The two-sided p-values compare each goods category with Software, or each other country with the UK, after adjustment for the other factor. For example France and the rest of Europe differ significantly from the UK at 5%, but Germany does not. The raw-scale significant goods differences are Books, Clothing, Electronic Goods, Groceries and Leisure Travel; these are individual reference-level comparisons, not an overall test of the goods factor.
The coefficient of determination is . The omnibus F-test compares all 15 nonintercept coefficients with zero:with reference and . This says at least one factor contrast is nonzero under the assumed error model. There is one observation per cell, so an unrestricted goods-country interaction would saturate the model, leaving zero residual degrees of freedom. Without replication or a specified interaction structure, the residual variation cannot be separated into interaction and independent error.
The second fit applies a logarithmic transformation and fits the same factor design to . The Gaussian log-response model isIts intercept exponentiates to a fitted Software–UK conditional median of million euros. Goods coefficients now give multiplicative ratios to Software, and country coefficients give multiplicative ratios to the UK. The estimated country ratios areFor example the Books ratio is and the Sports Equipment ratio is , consistently across countries. The model assumes common relative, rather than common absolute, country effects. It also guarantees positive retransformed fitted values. Under normal log errors, the original-scale conditional mean is , whereas is the conditional median and geometric mean. Correcting the retransformation bias here multiplies the naive predictions by approximately .
The log-scale residual standard error is , with the same 36 residual degrees of freedom, corresponding to a typical multiplicative error multiplier . France and the rest remain significant reference-country contrasts; Germany remains nonsignificant at 5%. The log-scale significant reference-goods contrasts are Books, Music, Videos/DVDs, Clothing, Sports Equipment, Electronic Goods, Groceries and Leisure Travel. Event Tickets, Toys, Video Games and Housewares do not individually differ significantly from Software at that level. These p-values remain subject to the usual multiple testing qualification.
The log-scale is computed using variation in the logarithms, so it cannot by itself establish better fit on the original response scale. The change is plausible because spending varies widely in magnitude and relative discrepancies are more meaningful than constant absolute discrepancies, but it should be assessed with regression diagnostics, especially a residual-versus-fitted plot and a normal Q-Q plot. The minimum residual near merits inspection; the command summaries alone do not verify independent normal errors. Moreover these responses are forecasts, so the inferential p-values have a literal sampling interpretation only if an appropriate stochastic model for their uncertainty is justified.
The log-scale analysis of variance adds Goods and then Country. In this balanced design their effect spaces are orthogonal after removing the intercept, so the sequential sums of squares equal the corresponding adjusted factor sums and are unchanged by reversing the two factors:The residual sum of squares is , giving . ThusTheir tiny upper-tail p-values show strong overall goods and country effects under the log-error model; a globally significant country factor is compatible with the nonsignificant individual Germany contrast. The omnibus fit statistic is on degrees of freedom, whose p-value is approximately . The printed zero reflects numerical formatting, not an exactly zero probability.
If two cell entries were missing, retain their correct factor labels and mark those responses unavailable, rather than shifting the remaining scan values into different cells. Fit the additive models to the 50 observed cells, assuming the missingness mechanism permits those observations to be analyzed without selection bias. All factor levels remain represented, and the row-column incidence graph remains connected: any two goods rows still share an observed country, since only two edges of the complete layout have been removed, and every country still has many observed goods. By identifiability of an incomplete two-factor additive design, the design therefore still has rank . HenceThe coefficients and their covariance must be recomputed by the observed-cell ordinary least squares equations. The balanced row-mean-plus-column-mean formulas and common within-factor standard errors no longer apply. Goods and Country effects are generally no longer orthogonal, so sequential ANOVA sums can depend on order; factor tests adjusted for the other factor should use nested model comparisons. Missing cells do not restore replication or make an unrestricted interaction test possible: that larger model still fits every observed cell exactly. If missingness depends on the unavailable spending values, additional modelling of that mechanism would be needed.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 41 1 Solution Created 2026-10-03 Updated 2026-10-14
Write . In this normal linear model, the ordinary least squares criterion is . Differentiating with respect to gives the normal equations for linear least squares, . Full column rank of the design matrix makes invertible, and completing the square proves that the unique minimum isSince , its sampling distribution is the multivariate normal distributionLet be the hat matrix. It is symmetric and idempotent with rank , and . The regression residual vector is , soAn orthogonal projection of a Gaussian vector onto the residual space gives . The residual projection and fitted projection have zero cross-covariance, hence are independent because they are jointly normal. In particular, is an unbiased estimator of and is independent of . The maximum-likelihood estimator of instead divides by and is not unbiased.
For the null hypothesis , put . Under that null hypothesis, is standard normal and independent of . Therefore the Student t-test usesA two-sided level- test rejects when . The denominator is the estimated standard error of the regression coefficient.
The fitted linear regression includes an intercept and three covariates:Thus , and the residual degrees of freedom are . The fitted conditional mean isEach slope measures a conditional association with the response while the other two covariates are held fixed. Increasing wind speed by one mile per hour corresponds to a fitted decrease of in the concentration units used. Its standard error is , giving and a two-sided p-value of : evidence of a negative conditional association at the 5% level. The temperature slope is per degree Fahrenheit, with standard error , and p-value . The insolation slope is per langley per day, with standard error , and p-value . Neither of these last two conditional effects is significant at 5%; that does not establish that either true slope is zero. These are associations, not a demonstration of causal effects.
The intercept estimates the mean at zero values of all three covariates. Its value has a large standard error , giving and p-value . The zero-covariate combination may be outside the observed range, so this test may have little practical relevance. Every coefficient test uses a Student t-distribution with degrees of freedom.
The reported residual standard deviation measures unexplained variation in concentration units; the subsequent table gives , consistent with after rounding. The five-number residual summary describes the spread, from to , with median . An intercept forces the residual sum to zero, not the residual median. These five numbers alone cannot establish normal errors, constant variance or independence; residual-versus-fitted and quantile-quantile plots would be more informative, and successive days also warrant checking serial dependence. The coefficient of determination means that 65.33% of the sample response sum of squares about its mean is explained by this fit. Its adjusted version iswhich accounts for the number of estimated regression coefficients.
The stepwise selection by the Akaike information criterion searches between the intercept-only model and the specified model with all three main effects. For these Gaussian fits, the printed Akaike information criterion is, up to a constant common to the candidates,The full model has and AIC . Removing insolation increases the residual sum of squares by but decreases AIC to , so that removal is chosen. Removing temperature or wind instead would give AIC or and is worse. In the next step the candidate models include deletions and restoration of insolation. Keeping wind and temperature has the smallest AIC: removing temperature gives , restoring insolation gives , and removing wind gives . Hence the search stops, givingThe accompanying F-tests compare a larger model with a one-parameter reduction: , where is estimated from the larger model. For example, removing insolation gives , equal to the corresponding squared test statistic. Deletions from the second-stage model use in the denominator, whereas restoring insolation uses the full-model denominator. These tests describe the comparisons; they do not determine the AIC choice. In particular, temperature is retained despite its deletion-test p-value . AIC balances fit and complexity, and a stepwise optimum need not be a global optimum over a richer model class. Ordinary coefficient inference after choosing a model does not account for the selection itself.
For positive responses, the Box–Cox transformation is for , and . Its profile likelihood refits the linear regression and variance at each and includes the transformation Jacobian. The graph peaks at roughly –. The approximate 95% likelihood-ratio confidence interval contains values a little below zero through approximately one, using the cutoff . Thus a logarithmic transformation () and a square-root transformation () are plausible, while leaving the response on its original scale () is at or very near the upper confidence boundary. The broad profile supports considering a mild power transformation; it does not determine a sharply estimated power. The raster does not justify more precise endpoints or a decisive assertion about which side of the boundary lies.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 102 1 b Solution Created 2026-10-03 Updated 2026-10-14
If a department has population , crimes against persons and crimes against property, cancellation of the common numerator givesThus is a property-to-person crime count ratio, not its reciprocal. Both counts must be positive for the printed ratio to be defined.
For the reconstructed 85-row data, fit a normal linear model for the Box–Cox transformation , including four region contrasts plus Literacy, Donations and Wealth. With and , the profile likelihood, up to constants, isThe second term is the transformation's Jacobian determinant; omitting it would incorrectly compare different response scales. Maximization gives , with approximate 95% likelihood-ratio confidence interval . The logarithmic transformation is inside this interval, whereas the raw-scale choice is far outside: the twice-log-likelihood drops at zero and one are and , respectively. A log-response model is therefore a simple supported choice.
In the full log model, partial F-tests give for Region (), for Wealth (), and for Literacy and Donations. Dropping Literacy and Donations together gives and . A parsimonious final normal linear model, with C as reference and , isThe standard errors in that order are ; residual standard deviation is on 79 degrees of freedom and . Use residual-versus-fitted and quantile-quantile plots, influence diagnostics and checks for remaining curvature to assess the working Gaussian model; the small p-values alone do not validate its assumptions.
Holding Region fixed, worsening wealth rank by ten positions multiplies the fitted conditional median ratio by . Relative to C at the same wealth rank, the fitted median multipliers are for E, for N, for S and for W. Region and wealth rank explain much of the variation; Literacy and Donations add little once those terms are included. These are associations in the reconstructed dataset. Back-transforming the fitted log mean gives a conditional median under lognormal errors; estimating an original-scale mean requires bias correction after an inverse transformation. Also, the public archive's metadata describe some historical measures differently from the exam wording, so the fitted Donations effect is interpreted only on its recorded scale.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 1 5J ii Solution Created 2026-09-24 Updated 2026-10-05
A residual-versus-fitted plot for the untransformed fit places on the vertical axis and on the horizontal axis. A fan-shaped cloud, with larger residual spread at larger fitted weight, suggests heteroscedasticity and approximately multiplicative errors. A logarithmic transformation may stabilize this spread when the conditional standard deviation is roughly proportional to the mean.
One can also use the scale-location plot of against fitted values, where is a standardized residual. A systematic rise suggests nonconstant error variance. Neither plot proves that taking logarithms is sufficient: diagnostics of the transformed fit should be checked as well, and dependence between repeated chicken measurements is a separate issue.
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 1 13J iii Solution Created 2026-09-24 Updated 2026-09-29
Because
model2 uses a logarithmic transformation, the logarithm of the payment ratio is the difference of two predicted log payments. The cars have equal Brand and Bonus values and differ by one Kilometres level, so its fitted mean is the displayed mileage regression coefficient, .For two independent future payments, the prediction interval must include both the standard error of and two independent residual errors. The estimated variance of the predicted log ratio is thereforeUsing the residual degrees of freedom shown in the output, a 95% prediction interval for a ratio of log-normal responses isWith , this is approximately . The interval is wide because it predicts the ratio of two individual future payments; an interval for the ratio of their fitted mean responses would omit the term.
Past exam of the mathematics course of the University of Cambridge 2020 ii Paper 1 13J ii Solution Created 2026-09-24 Updated 2026-09-29
The graph is a profile likelihood for the parameter of a Box–Cox transformation. Its maximum is close to , and the displayed likelihood interval contains zero but excludes . Since gives a logarithmic transformation whereas leaves the response unchanged up to an affine transformation, the plot supports fittingas the response in
model2. Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 218 3 a Solution Created 2026-09-28 Updated 2026-10-03
Use in picoseconds and . Since the time uncertainty is negligible, only the vertical errors enter. First-order propagation of uncertainty givesThe transformed measurements areThus the logarithmic transformation converts constant fractional rate uncertainties into approximately equal absolute log-rate uncertainties. The equality is the linear error approximation; finite error bars would become slightly asymmetric under an exact logarithm.
Weighted geometric mean 2026-10-14
For positive real numbers and nonnegative weights with , the weighted geometric mean isIt takes a weighted mean of logarithms. A zero weight excludes that input; equal weights give the ordinary geometric mean. If occurs times in a list of total length , its correct weight is . For the list ,and replacing all four entries by preserves the product .
There is also an optimization interpretation. A logarithmic transformation turns multiplicative discrepancies into additive ones. For a positive representative , the weighted mean minimizes squared deviations identity givesThus uniquely minimizes weighted quadratic loss in logarithmic coordinates. The weighted arithmetic mean minimizes squared discrepancies in the original coordinates. These two objectives explain why different choices of what constitutes an error select different summaries.
The strictly concave function and the reversed Jensen's inequality give , where is the weighted arithmetic mean. Apply the same reasoning to the multiplicative inverses to get for the weighted harmonic mean. Thus ; equality holds exactly when all positive-weight inputs agree. For this list, , , and . The weights specify which inputs are represented and must stay the same across the comparison.