Box plot 2026-10-14
A box plot compresses a statistical sample into a box spanning its lower and upper quartiles , a line at its median , and two whiskers. It makes location and central spread easy to compare across groups on a common value axis. The box represents the central half in terms of quantile levels; with ties or interpolated quartiles, it need not contain exactly half the observations. Whisker endpoints require a stated convention: they can be the observed extremes, or they can stop short of separately marked observations. [ref]
https://www.itl.nist.gov/div898/handbook/eda/section3/boxplot.htm. NIST/SEMATECH, Box Plot, definition and variants
Here is one explicitly toy dataset, reused under histogram: twelve invented, unitless values, with repeated values counted separately, already arranged as order statistics:For this box plot we choose the interpolated quartiles defined under quartile, using R's type-7 rule. This givesThe interquartile range is . Our whisker convention uses the fencesThe whiskers end at the smallest and largest observations in the closed interval : here and . Values strictly outside the fences receive separate outlier markers: here only . An observation exactly on a fence is retained within the whisker under this convention. The fences are thresholds, not observed whisker endpoints; the upper whisker is at , not . R's documented whisker rule likewise includes observations no more than box lengths away, although its box uses hinges, which can differ from our type-7 quartiles. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html. R grDevices documentation, boxplot.stats, coef and hinges
A separate outlier marker is a prompt to investigate, not a finding that the value is bad data and not an instruction to delete it. A distant observation can be a recording error, a legitimate unusual outcome, or evidence that the assumed statistical model misses some behavior. Check its provenance and context before deciding how to analyze it. No measurement-error claim is possible for our invented : we deliberately put it there to demonstrate the rule. [ref]
https://www.itl.nist.gov/div898/handbook/eda/section3/eda35h.htm. NIST/SEMATECH, Detection of Outliers, labeling and investigation
The beauty of a box plot is its compact comparison of ordered positions rather than every observation. That compression also loses information: many different statistical samples have the same quartiles and whiskers, so the box alone cannot reveal every cluster or gap that a histogram might show. For example, replacing the two invented values by and leaves the type-7 quartiles, whiskers and separate marker unchanged. Displaying the individual values alongside the box plot is especially helpful for such a small statistical sample. Always state both the quartile rule and the whisker rule; changing either can change which values are marked.
Histogram 2026-10-14
A histogram groups numerical observations into adjacent intervals called bins and draws one rectangle per bin. Its attraction is that a long list of values becomes a visible pattern of concentration, gaps and skewness. Specify the bin edges, the treatment of values on those edges, and what the vertical axis means: count, proportion, or density. Those choices are part of the graphic. [ref]
https://www.itl.nist.gov/div898/handbook/eda/section3/histogra.htm. NIST/SEMATECH, Histogram, definition and normalization
Let observations be covered by disjoint bins with positive widths and counts , so . For example, use left-closed, right-open bins, closing the final right edge too. The three common height choices have different meanings:
For the density convention, a histogram is a piecewise constant probability density function estimate:Its normalization follows by adding rectangular areas:If the observations have units, density has reciprocal units; a density height is not a probability and can exceed . With equal bin widths, count heights and density heights differ only by a common scale factor. With unequal widths, count-height areas give wider bins extra visual weight unrelated to their counts. Dividing by width removes that distortion. R's histogram documentation explicitly describes area-one normalization for unequal bins. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/hist.html. R graphics documentation, hist, frequency versus density
Reuse the twelve invented values under box plot, with bins . The counts are and the widths are . Hence the density heights and areas are exactlyThe second and third bars have equal density heights even though the third contains twice as many observations: it is also twice as wide. The last bar contains only two observations; its count-height area would be , larger than the six-observation bar's . Its correct density area is only .
Bin choice trades detail against stability. Broad bins merge distinctions: the toy bin hides the empty stretch between and . Narrow bins expose gaps but can make each individual observation dominate a bar. With one-unit bins starting at , the bins each contain two values and appear equally prominent; that apparent pattern depends on grouping the repeated integers together. Moving the bin origin also changes membership without changing the observations. For density estimation, this is a form of the bias-variance tradeoff: averaging over broad bins loses local detail, while narrow bins give more variable density estimates across repeated statistical samples. [ref]
https://www.stat.cmu.edu/~cshalizi/uADA/24/lectures/ch14.pdf. Cosma Rohilla Shalizi, Estimating Distributions and Densities, Section 14.1
A useful practice is to compare a few plausible widths and offsets, keeping common edges when comparing groups. Automatic bin selectors are starting points, rather than guarantees of a unique correct picture. [ref]https://numpy.org/doc/stable/reference/generated/numpy.histogram_bin_edges.html. NumPy documentation, histogram_bin_edges, Notes on bin selectors
A histogram retains only bin membership. Its density estimate spreads each bin's fraction uniformly across that bin, so our last bar assigns density throughout even though the only toy values there are and . It does not recover within-bin positions or observation order, and a visually convincing shape does not establish a population probability distribution. A box plot provides a complementary compact summary of quartiles; neither graphic replaces the original observations.
Interquartile range 2026-10-14
The interquartile range measures the width between the lower and upper quartiles, in the same units as the observations. It describes central spread rather than the distance between the observed extremes. In our toy box plot, ; moving the largest value from to would leave the quartiles and interquartile range unchanged under the chosen rule, because the order statistics used in their interpolation would not change.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 41 1 Solution Created 2026-10-03 Updated 2026-10-14
scan reads the numerical prices, including the three missing-value markers, into a vector. The data must be read row by row for the subsequent factor construction to match them. The sample size available for analysis is therefore , rather than . The numerical summary describes the observed prices: the sample median is £43.54 and the sample mean is £46.94. The upper tail, particularly the boots, raises the sample mean above the sample median. These summaries mix very different products and are not adjusted country comparisons.The two character scans create labels.
gl(8,5,length=40,labels=item) makes a regression factor with each of eight item labels repeated five times. gl(5,1,length=40,labels=country) cycles through the five country labels once for each item. For a regression factor and numerical response, the two plot commands produce grouped box plots. The country box plots suggest lower US prices, while the item box plots show particularly expensive boots and inexpensive cardigans. They are descriptive displays of this small basket, with different item compositions where prices are missing; they cannot separate country effects from item effects.The first
lm fits an additive two-way analysis of variance:The constraints are R's usual treatment coding. The normal linear model used for the printed tests assumes independent errors with common variance and approximately a normal distribution, and no item-by-country interaction in the mean. Missing prices are omitted, leaving responses and independent mean coefficients. Thus the residual degrees of freedom are . This deletion is defensible for the conditional price model when missingness does not depend on the unobserved error after conditioning on the two factors; the output itself does not establish such a missing-data mechanism.The
anova tables report sequential sums of squares, rather than order-independent adjusted effects. If are the residual sums of squares from the intercept-only, country-only, item-only and additive fits, the first order allocates to country and to item. The second order allocates to item and to country. Both allocations sum to the same total explained sum of squares, and both end with the same residual sum of squares . The three missing combinations destroy balanced factorial orthogonality, so the allocation changes with order. To test country after allowing for items, use the country row in the second table; to test item after allowing for countries, use the item row in the first table. The first-entered rows do not supply those adjusted tests.Each mean square in ANOVA divides its sum of squares in ANOVA by its statistical degrees of freedom, and each printed F-statistic divides that mean square in ANOVA by . In particular, the adjusted country partial F-test haswith an reference F-distribution and p-value approximately . The adjusted item partial F-test gives on statistical degrees of freedom. Both factors contribute strongly under the additive normal linear model. The larger item sum of squares in ANOVA measures the much greater differences between these products, but is not evidence that every pair of items differs significantly.
The intercept is the fitted UK price for the reference jeans, not their observed price and not the overall sample mean. Each country regression coefficient is its adjusted price difference from the UK, assumed common across items: Sweden is £5.224 lower, France £10.708 lower, Germany £7.676 lower and the US £21.328 lower. Each item regression coefficient is its adjusted difference from the reference jeans, assumed common across countries. Thus the fitted UK boots price is , and the fitted US boots price is .
The coefficient standard errors come from , where and is the design matrix. Dividing each estimate by its standard error gives the displayed Student t-test statistic, with statistical degrees of freedom. The stars summarize the corresponding two-sided p-values. The individual tests compare each indicated country or item with its reference level, conditional on all other additive terms; they are neither tests of every pairwise comparison nor a simultaneous confidence interval procedure. In particular, Sweden's p-value provides weaker evidence than the other country contrasts, and does not establish equality with the UK. The intercept test has little substantive relevance, and interpreting many individual stars also raises multiple hypothesis testing issues.
The residual standard error measures unexplained prices in pounds. With total corrected sum of squares , the coefficient of determination and adjusted coefficient of determination areMuch of this impressive fit is due to the large differences between items. The overall F-test compares the additive fit with a constant mean: on statistical degrees of freedom. It tests that all eleven non-intercept coefficients vanish, not that the additive model is adequate. Regression diagnostics should examine regression residuals, changing price variability across items and possible interaction. Percentage differences may be more plausible than common pound differences, motivating a natural logarithm of price. No random sample of countries or products, and no independent replication of a price within a cell, is supplied; broad claims about all designer goods or the causes of country differences require more than these conditional tests.
Finally,
Item*Country expands to both main effects and their full interaction. A cell-means parameterization has one separate fitted mean for every observed cell. With one response per cell its design matrix has row matrix rank , while the full layout nominally has coefficients. Three coefficient combinations are aliased because their cells are missing. This is saturation of an unreplicated two-factor regression: every observed price is fitted exactly and the residual degrees of freedom are zero. The final fit has zero residuals, and no residual-based estimate of the error variance or ordinary interaction significance test. The printed numerical summary will mark three coefficients unestimable; coefficient standard errors, tests and adjusted involve undefined division by zero, potentially appearing as NaN or Inf according to numerical roundoff. Perfect interpolation here is a consequence of a saturated statistical model, not evidence for a superior predictive model. Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 102 1 a Solution Created 2026-10-03 Updated 2026-10-14
The examination used separately emailed files. For this question a public Guerry data archive and its CSV mirror permit a documented reconstruction: retain the 85 records with a recorded region and select the specified columns. All six printed records match exactly, and each of the five regions has 17 departments. The numerical results below refer to that reconstruction; the remaining rows cannot be checked against the unavailable emailed file.
Treat department identifiers as labels and region as a categorical variable. The following summaries show the scale and spread of the quantitative variables:
A larger population-per-crime value means a lower crime rate, and a smaller wealth rank means greater recorded wealth. Donations are markedly right-skewed, as the large gap between mean and median and the upper tail indicate; rank is an ordinal measure rather than a monetary difference. For the ratio analysed next, the median is , the interquartile interval is , and the range is .
Regional median ratios are in C, in E, in N, in S, and in W. The regional box plots and wealth-versus-log-ratio scatter plot in the figure expose this geographical contrast and an inverse association with wealth rank. North has the highest typical property-to-person crime ratio and South the lowest in the reconstructed data. These summaries are descriptive departmental comparisons, not causal or individual-level conclusions.
Quartile 2026-10-14
Quartiles are the quantiles at probability levels ; is a median. For a population we can use its quantile function, for . Finite-sample conventions differ. Our box plot uses linear interpolation between order statistics: for and , setThen . This is R's type-7 convention, described in the documentation authored by Ivan Frohne and Rob J Hyndman. It differs from the generalized-inverse sample quantile defined elsewhere in this wiki: for the twelve toy values, that rule selects ranks and gives , rather than . These are different stated conventions, not arithmetic disagreements. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html. Frohne and Hyndman, R stats documentation, sample quantile types

