Two classes take the same test. Both have a median of 8 marks. Are they the same? Not if one class has marks from 2 to 15 and the other has marks from 6 to 10. To compare data you need a centre (a typical value) and a spread (how much the values vary). This section is about showing data clearly, measuring it, and saying what it means in context.
Types of data
Discrete data 离散数据 can take only certain values, such as the number of children in a family.
Continuous data 连续数据 can take any value in a range, such as height or time.
Univariate data has one variable; bivariate data 双变量数据 has two variables measured on each item, such as the height and mass of each student.
Centre and spread
Measure
Kind
Note
Mean $\bar x$
centre
uses every value; pulled by extreme values
Median
centre
the middle value; not affected much by extreme values
Mode
centre
the most common value
Range
spread
largest minus smallest; affected by extreme values
Interquartile range 四分位距 (IQR) $=Q_3-Q_1$
spread
the spread of the middle half
Standard deviation 标准差$\sigma$
spread
the typical distance of the values from the mean
Skew pulls the mean away from the median
Use the median and IQR when the data has extreme values or is skewed. Use the mean and standard deviation when the data is fairly symmetric.
Standard deviation
The variance 方差 is the mean of the squares minus the square of the mean:
For raw data, use your calculator's statistics mode. Use the formula when you are given only the totals. For a frequency table, use $\sigma^2=\frac{\sum fx^2}{\sum f}-\bar x^{\,2}$.
What standard deviation means. For many data sets, most values lie within 2 standard deviations of the mean. If you add the same number to every value, the mean changes but $\sigma$ does not. If you multiply every value by 3, both the mean and $\sigma$ are multiplied by 3.
Histograms
In a histogram 直方图 the area of each bar shows the frequency. The height is the frequency density 频率密度:
Worked example. Classes $0$–$10$, $10$–$20$ and $20$–$40$ have frequencies 20, 30 and 20. The densities are $\frac{20}{10}=2$, $\frac{30}{10}=3$ and $\frac{20}{20}=1$. The widest bar is the shortest, but it still holds 20 values.
In a histogram area shows frequency, so the wide bar is not more data; same median, but B has the smaller IQR
Worked example: reading a histogram. How many values lie between 15 and 30?
From 15 to 20: $3\times5=15$. From 20 to 30: $1\times10=10$. The total is about $25$. It is an estimate, because you assume the values are spread evenly inside each class.
Common mistake. Calling the tallest bar the biggest class. Compare areas, not heights.
Grouped data: mean and median
Use the midpoint of each class to estimate the mean.
To estimate the median, use linear interpolation 线性插值. With 70 values, the median is the 35th. There are 20 values below 10 and 50 below 20, so the 35th is in the class $10$–$20$: it is the 15th of that class's 30 values.
The median (15) is a little below the mean (16.4), which suggests a slight positive skew.
Cumulative frequency. Plot the cumulative frequency at the upper class bound of each class and join the points. Read off $Q_1$, the median and $Q_3$ at $\frac14$, $\frac12$ and $\frac34$ of the total. For the data above: $Q_1\approx8.75$, median $15$, $Q_3\approx22.5$.
Read quartiles across at a quarter, half and three quarters of the total; a regression line predicts well only inside the range of the data
Box plots and outliers
A box plot 箱线图 shows the minimum, $Q_1$, the median, $Q_3$ and the maximum. It makes comparing two data sets easy.
Parallel box plots compare centre, spread and outliers of two groups
Worked example. In the figure, A and B both have median 8. A has IQR 6 and B has IQR 4. So the typical marks are the same, but B's middle half is less spread out: B's results are more consistent.
An outlier 离群值 is a value far from the rest. A common rule is: a value is an outlier if it is more than $1.5\times$IQR below $Q_1$ or above $Q_3$. Another rule uses $\bar x\pm2\sigma$. Use the rule the question gives.
Worked example.$Q_1=12$ and $Q_3=20$, so IQR $=8$. The fences are $12-1.5\times8=0$ and $20+1.5\times8=32$. A value of 35 is beyond 32, so it is an outlier by this rule.
Remove an outlier only if it is an error, such as a height of 17 m. A genuine extreme value stays in the data. This is called cleaning data 数据清洗.
Skew
Shape
Box plot
Mean and median
symmetric
median in the middle of the box
mean ≈ median
positive skew 正偏态 (long tail to the right)
median nearer $Q_1$
mean > median
negative skew 负偏态 (long tail to the left)
median nearer $Q_3$
mean < median
Scatter diagrams and correlation
A scatter diagram shows bivariate data. Correlation 相关性 describes how close the points are to a straight line:
positive: as one variable increases, the other tends to increase;
negative: as one increases, the other tends to decrease;
none: no clear linear pattern.
Correlation is not causation. Ice-cream sales and drowning both rise in summer, but ice cream does not cause drowning: hot weather affects both.
Interpreting a regression line
A regression line 回归直线$y=a+bx$ is the line of best fit for predicting $y$ from $x$. You will not need to calculate it, but you must interpret it.
Worked example. For students who revised for 1 to 10 hours, test mark $y$ and hours $x$ fit $y=3.2+0.85x$.
Gradient: each extra hour of revision adds about 0.85 marks.
Intercept: 3.2 marks with no revision. $x=0$ is outside the data, so treat this with care.
At $x=6.5$: $y=3.2+0.85\times6.5=8.7$. This is interpolation 内插 (inside the data range); its reliability also depends on how closely the data fit the line.
At $x=40$: $y=37.2$. This is extrapolation 外推 (outside the data range): it may be beyond the maximum mark and is not reliable.
Predict inside the data range; outside it the line may no longer hold
Traps
Misleading
Sound
a histogram's tallest bar called the biggest class
area is frequency: compare areas
an axis that does not start at 0, exaggerating a change
read the scale and its starting value
equal medians called equal distributions
compare a spread as well as a centre
a comment with no context
“B's middle half is less spread, so B's marks are more consistent”
Practice
A class $30$–$50$ holds 40 values. Find its frequency density.
$n=5$, $\sum x=20$, $\sum x^2=100$. Find the variance.
$Q_1=6$ and $Q_3=15$. Find the IQR and the upper fence for outliers.
Data: 2, 3, 3, 5, 7, 8, 30. Which average and spread would you use, and why?
A regression line for 5 to 20 years old is $h=80+6a$ (height in cm, age in years). Interpret 6, and comment on using it at $a=40$.
Answers.
$\frac{40}{20}=2$.
$\frac{100}5-4^2=20-16=4$.
IQR $=9$; upper fence $15+13.5=28.5$.
Median and IQR: the value 30 is an outlier and would pull the mean and standard deviation.
Height rises about 6 cm per year of age; $a=40$ is extrapolation, and adults stop growing, so $h=320$ cm is nonsense.
Key points
Compare a centre and a spread, in context.
$\sigma^2=\frac{\sum x^2}n-\bar x^{\,2}$; use it with summary totals.
In a histogram, area is frequency and height is frequency density.
Grouped data give estimates: midpoints for the mean, interpolation for the median.
Outliers: beyond $Q_1-1.5\times$IQR or $Q_3+1.5\times$IQR, or the rule given. Remove only errors.
Correlation is not causation; extrapolation is unreliable.