Descriptive statistics, outliers and linear transformations

IB Math AA · Statistics and Probability

Measures of centre and spread

The mean uses every value and is pulled by extreme ones; the median is the middle value and is not. For a frequency table, $\bar{x}=\dfrac{\sum fx}{\sum f}$, and the variance is

$$\sigma^{2}=\frac{\sum f\left(x-\bar{x}\right)^{2}}{\sum f}=\frac{\sum fx^{2}}{\sum f}-\bar{x}^{2}$$

Quartiles, interquartile range and outliers

$\text{IQR}=Q_3-Q_1$. A value is treated as an outlier when it is more than $1.5\times\text{IQR}$ beyond $Q_1$ or $Q_3$:

$$x<Q_1-1.5\,\text{IQR}\qquad\text{or}\qquad x>Q_3+1.5\,\text{IQR}$$

On a box plot the whiskers stop at the most extreme values that are not outliers; outliers are plotted individually.

Linear transformations

If $y=ax+b$ then

$$\bar{y}=a\bar{x}+b,\qquad \sigma_y=|a|\,\sigma_x,\qquad \sigma_y^{2}=a^{2}\sigma_x^{2}$$

The constant $b$ shifts the centre but leaves every measure of spread unchanged.

Grouped data

With grouped data the individual values are lost, so the mean is estimated using the class midpoints, and the median is estimated by linear interpolation inside the class that contains the middle value.

IQR = 52 − 40 = 12 1,5 × IQR = 18 upper threshold = 52 + 18 = 70 78 > 70 ⇒ outlier 24 40 46 52 66 78 20 30 40 50 60 70 80 The left whisker has length 16, the right whisker length 14: the data is nearly symmetric in the middle, but one observation lies well outside the threshold.
A box plot reads out five numbers, and the outlier threshold must be calculated. The box runs from $Q_1=40$ to $Q_3=52$ so $\text{IQR}=12$; the outlier thresholds are $Q_3+1.5\times\text{IQR}=70$ and $Q_1-1.5\times\text{IQR}=22$. The value $78$ lies beyond the upper threshold so it is drawn with its own cross, and the whisker only extends to $66$ — the largest value still inside the threshold, not to the largest value of the data. This is the most frequent misreading: the end of the whisker is not always the max. The figure also shows why the median is more robust than the mean: moving the point $78$ any farther out does not make the $46$ line budge, while the mean slides along immediately.

Worked example: frequency table: mean, median, standard deviation

The table below records the number of times $30$ students were late in one month.

Number of late arrivals $x$$0$$1$$2$$3$$4$
Number of students $f$$5$$8$$10$$4$$3$

Find the mean, median and standard deviation.

Solution

Mean. $\sum f=30$ and

$$\sum fx=0(5)+1(8)+2(10)+3(4)+4(3)=0+8+20+12+12=52$$$$\bar{x}=\frac{52}{30}=1.733$$

Median. With $n=30$, the median is the mean of the $15$th and $16$th observations. Cumulative frequencies: $5,\ 13,\ 23,\ 27,\ 30$. The $15$th and $16$th observations both fall in the group $x=2$ (this group spans from the $14$th to the $23$rd observation), so the median is $2$.

Standard deviation.

$$\sum fx^{2}=0+8+40+36+48=132$$$$\sigma^{2}=\frac{132}{30}-\left(1.733\right)^{2}=4.4-3.004=1.396\;\Longrightarrow\;\sigma=1.18$$

Sensibility check: the data runs from $0$ to $4$, so the standard deviation must be smaller than half the range ($2$). If you get $4.4$, that is $\dfrac{\sum fx^{2}}{\sum f}$ — forgetting to subtract $\bar{x}^{2}$.

Worked example: outliers before and after a transformation

A data set has $Q_1=34$, median $46$, $Q_3=58$, minimum value $12$ and maximum value $108$. Identify the outliers. Then each value is transformed by $y=2x+5$; state the new $Q_1$, $Q_3$, $\text{IQR}$ and say whether the outlier status changes.

Solution

Outlier thresholds. $\text{IQR}=58-34=24$ so $1.5\times\text{IQR}=36$:

$$\text{lower threshold}=34-36=-2,\qquad \text{upper threshold}=58+36=94$$

The value $12$ is greater than $-2$ so it is not an outlier; the value $108$ is greater than $94$ so it is an outlier.

After the transformation $y=2x+5$. The transformation is increasing so it preserves order, hence the new quartiles are the images of the old quartiles:

$$Q_1'=2(34)+5=73,\qquad Q_3'=2(58)+5=121,\qquad \text{IQR}'=121-73=48$$

Note $\text{IQR}'=2\times 24=48$: the factor $2$ multiplies in, while the $+5$ has no effect.

Does the outlier status change? The new upper threshold is $121+1.5(48)=193$, and the new maximum value is $2(108)+5=221>193$. Still an outlier.

This is no coincidence: a linear transformation multiplies all distances by the same factor $|a|$, so the ratio "distance from $Q_3$ divided by $\text{IQR}$" does not change. An outlier stays an outlier, and a normal value stays normal.

Common mistake

Applying the added constant to the standard deviation. With $y=3x-10$, the student writes $\sigma_y=3\sigma_x-10$ just as they wrote $\bar{y}=3\bar{x}-10$. The mechanism: the two formulas sit side by side in the mind and differ in only one place, so memory merges them. But the standard deviation measures the distances between the data and the mean, and adding $-10$ shifts the whole set of numbers and the mean by $-10$ — all distances stay the same. Only multiplication stretches distances, and it stretches them by exactly $|a|$ times. This trap has two other variants that are also common: writing $\sigma_y=a^{2}\sigma_x$ (using the rule for variance for the standard deviation), and forgetting the absolute value sign when $a<0$, giving a negative standard deviation. A self-check that takes five seconds: take any two numbers, say $10$ and $20$; transform them to $20$ and $50$; the distance goes from $10$ to $30$, exactly $3$ times, not $3$ times and then minus $10$.

Key takeaway

With a frequency table, the denominator is always $\sum f$, not the number of rows. With a box plot, the outlier threshold must be calculated, not estimated by eye, and the end of the whisker is not always the largest value. With a linear transformation, an added constant touches only the center, not the spread.

← Vectors, lines in space and the scalar product · All IB Math AA lessons · Practice IB Math AA questions (free, instant scoring) · Probability rules, conditional probability and tree diagrams →