Describing data

Lecture 1 (course introduction, data types, centre and spread) and Lecture 2 (descriptive statistics, shape, charts), rebuilt as one storyline: decide what kind of variable you have, summarise its centre and spread, read its shape, then pick the right picture.

How to read this page. It is ordered by concept, not by slide. Every card says which slides it came from, what to read first, and what uses it later. The probability story starts on Design, probability and Bayes.

Teal = explanation added by Claude, not on the slides. Amber = watch out. Dropdowns hide worked examples, practice questions, and their answers.

The road through the two lectures

Side stops: the scientific method, notation, pictographs and line charts. Factorials (L1 s91, L2 s48) live on the probability page under Counting, where they are used.

Lecture map: which slides each card covers

Part 1

What kind of data is it?

Classify the variable first. Everything else on this page depends on that choice.

How we come to know things: the scientific method

We learn from our senses, from other people, from experts and from logic, but each can mislead us. Science combines them into a loop of observing, guessing, testing and checking, which is why it is the most reliable way to decide under uncertainty.

Ways of knowing and their limits: the sensory system (what we feel may not be accurate), social consensus (most people once believed the Earth was flat), consulting an expert (trusted sources still have biases), logic and reasoning (if \(A = B\) and \(B = C\) then \(A = C\), but logic depends entirely on the truth of the starting assumptions).

The scientific method (empirical approach) combines them in a systematic, self-correcting way: observation (measured), hypothesis formulation, controlled experimentation, data collection and analysis, replication and peer review. It does not claim absolute truth, but it is the most reliable framework for decisions under uncertainty.

Five steps of empirical research: 1. recognise and identify a problem; 2. formulate hypotheses; 3. determine the information needed and how to obtain it (data collection); 4. organise the information (data analysis); 5. interpret the results to draw conclusions. The cycle then repeats.

Steps 3 to 5 are this course: Lectures 1–2 are step 4 (describe), Lecture 3 onwards is step 5 (infer). Exam questions on this slide are definition questions: know the five steps in order.

Variables and data types

Before you compute anything, decide whether a variable is a number you can do arithmetic with or a label for a group. That one decision fixes which summaries and which charts make sense.

A variable is any measurable factor that has an effect on a phenomenon. A variable has varying answers: "are you alive and breathing?" gives only "yes", so it explains nothing and is not useful.

Quantitative data take numeric values that allow mathematical operations: height, age, number of pages in a book, annual income.

Categorical data label a group or set of items: gender, letter grade, breakfast type, marital status, zip code.

Zip codes are tricky: adding two zip codes gives nothing useful, so a zip code is categorical even though it is a number.

Ordinal categorical data have a ranked order (letter grades, survey ratings from Very Poor to Very Good). Nominal data have no order (gender, marital status, zip code, breakfast items).

Continuous quantitative data can be split into smaller and smaller units and a smaller unit still exists (age in years, months, days, seconds; height; income). Discrete data take only countable values (number of kids, pages in a book, cats outside a coffee shop). We would not want to split our cats in half.

Analysing quantitative data has four aspects: measures of centre, measures of spread, the shape of the data, outliers. Categorical data are analysed by the counts or proportions in each group.

Nominal and ordinal are together called categorical; interval and ratio are together called numerical or quantitative (L1 s21).

AskIf yesIf no
Does adding two values give something meaningful?quantitativecategorical
Quantitative: is there always a smaller unit?continuousdiscrete (a count)
Categorical: do the labels have a natural order?ordinalnominal

Quantitative data get the full toolkit on this page. Categorical data only get counts, proportions, bar charts and pie charts, and the mode is their only measure of centre.

Numbers that are really labels: zip codes, student IDs, phone numbers, jersey numbers. All categorical. And a count stored with decimals is still discrete; a measurement recorded in whole units (age in years) is still continuous.

Quantitative or categorical: ten variables
VariableTypeWhy
Zip codecategorical (nominal)a label, arithmetic is meaningless
Agequantitative (continuous)a measurement with ever smaller units
Incomequantitative (continuous)money can be averaged
Marital statuscategorical (nominal)no order
Heightquantitative (continuous)a measurement
Letter gradescategorical (ordinal)ranked labels
Travel distance to workquantitative (continuous)a measurement
Survey ratings (Poor, Ok, Great)categorical (ordinal)ranked labels
Temperaturequantitative (continuous)a measurement
Average speedquantitative (continuous)a measurement
Which categorical variables are nominal?

Nominal (no order): gender, types of fruit, nationality, genres of movies. Ordinal (ranked): letter grade, survey ratings, education level (HS, Bachelors, Master, PhD).

Which of these is a quantitative discrete variable?

(A) Blood type. (B) Weight of a package in kg. (C) Number of tabs open in a web browser. (D) Marital status.

(C). Blood type and marital status are categorical; weight is quantitative but continuous. A count of tabs is a whole number, so it is discrete.

Classify four variables, and is a 1–5 satisfaction scale nominal or ordinal?

(a) Number of apps installed on a phone. (b) Blood pressure in mmHg. (c) Preferred payment method (cash, card, mobile). (d) Time in minutes spent studying per day. C3: a service-quality scale from 1 (very poor) to 5 (excellent).

  1. (a) quantitative, discrete: a count.
  2. (b) quantitative, continuous: a measurement.
  3. (c) categorical, nominal: labels with no order.
  4. (d) quantitative, continuous: time always has a smaller unit.
  5. C3: ordinal. The labels have an order (very poor is below excellent), but the gaps between them are not fixed numbers, so it is still categorical.

The submitted assignment called study time "discrete" because it was recorded in whole minutes. Recording unit does not change the type: time is continuous.

Give one example each of a categorical, quantitative, discrete and continuous variable

Any sensible set works. For example: categorical, pen type (fountain, ballpoint, gel); quantitative, number of homework assignments in a semester; discrete, number of spoons in a cutlery set; continuous, temperature. Say why each fits: labels for the first, arithmetic for the second, a count for the third, ever smaller units for the fourth.

Pick the quantitative variable, then the categorical one

A2: (a) type of smartphone, (b) number of books read per month, (c) marital status, (d) favourite cuisine. A9: (a) age, (b) height, (c) exam score, (d) marital status.

A2: (b), a count whose average is meaningful. A9: (d), a label with no numerical meaning.

Notation: random variables, observed values, sums

A capital letter stands for a quantity whose value we do not know yet, and the small letter stands for one value we actually saw. The sigma sign is just a short way to write "add them all up".

Notation is a common language for mathematical ideas. A spreadsheet has rows (instances, individuals) and columns (variables).

A random variable is a placeholder for the possible values of some process, written with a capital letter: \(X\), \(Y\), \(Z\). Once we observe an outcome we write it in lower case: \(x_1 = 5,\ x_2 = 10,\ x_3 = 45,\ x_4 = 12,\ x_5 = 8\).

"What is the probability someone spends more than 20 minutes on our website?" With notation: \(P(X \gt 20)\). Response: one of five values, 20%.

An aggregation turns many numbers into fewer numbers. Summation uses the Greek sigma:

\[ \sum_{i=1}^{n} x_i = x_1 + x_2 + \dots + x_n \]

To sum only the first three values:

\[ \sum_{i=1}^{3} x_i = x_1 + x_2 + x_3 \]

Other aggregations: the product sign \(\prod\) multiplies all values; continuous values are aggregated by the integral \(\int\).

The mean in this notation:

\[ \bar x = \frac{1}{n}\sum_{i=1}^{n} x_i \]
\(X\)
the random variable (the column, before you look)
\(x_i\)
the \(i\)-th observed value
\(n\)
number of observations
\(\sum_{i=1}^{n}\)
add the terms for \(i = 1, 2, \dots, n\)
\(\bar x\)
sample mean ("x bar")
Reading \(P(X \gt 20)\) and \(P(X \ge 20)\) off five observations
  1. Values: 5, 10, 45, 12, 8. Only \(x_3 = 45\) is above 20.
  2. \[ P(X \gt 20) = \frac{1}{5} = 20\% \]
  3. No value equals 20 exactly, so \(P(X \ge 20)\) is the same 20%. The two differ only when a value sits exactly on the boundary.
Index notation on a four-row table

Rows: (5, IT, Part-Time), (10, Finance, Full-Time), (8, HR, Full-Time), (1, Finance, Part-Time) with columns \(X\), \(Y\), \(Z\).

\(x_1 = 5\), \(y_2 = \) Finance, \(z_3 = \) Full-Time, \(n = 4\).

Evaluate five expressions on \(x = (5, 15, 3, 3, 8, 10, 12)\)

A. \(n\). B. \(\sum_{i=1}^{n} x_i\). C. \(\sum_{j=2}^{7} x_j + 6\). D. \(x_5\). E. \(\dfrac{\sum_{i=3}^{6} x_i}{n-1}\). Which equals the mean?

  1. \[ n = 7 \]
  2. \[ \sum_{i=1}^{7} x_i = 5+15+3+3+8+10+12 = 56 \]
  3. \[ \sum_{j=2}^{7} x_j + 6 = 51 + 6 = 57 \]
  4. \[ x_5 = 8 \]
  5. \[ \frac{3+3+8+10}{6} = 4 \]
  6. \[ \bar x = \frac{56}{7} = 8 \] So D happens to equal the mean, but only by coincidence; the mean is B divided by A.

Part 2

Measures of centre

Three ways to say "a typical value". Which one to report depends on the shape (Part 4).

The mean

The mean is the ordinary average: add everything up and divide by how many there are. It uses every value, which is also why one huge value can drag it far from the rest.

The mean is often called the average or the expected value. We calculate it by adding all of our values together and dividing by the number of values.

\[ \bar x = \frac{1}{n}\sum_{i=1}^{n} x_i \]

The mean isn't always the best measure of centre because it is strongly influenced by very large or very small values, and it always returns a decimal value, even for discrete data types.

Dogs seen Mon–Sun: 5, 3, 8, 3, 15, 45, 9.

\[ \bar x = \frac{5+3+8+3+15+45+9}{7} = \frac{88}{7} = 12.57 \text{ dogs} \]
\(\bar x\)
sample mean
\(\mu\)
population mean (same recipe, whole population; see Symbols)

Six of the seven days had 9 dogs or fewer, yet the mean is 12.57 because Saturday's 45 pulls it up. That is the whole case for the median in the next card.

Mean, median and mode of the number of courses five students take

Ashley 1, Steve 1, Jeff 2, Kylie 3, Lisa 8.

  1. \[ \bar x = \frac{1+1+2+3+8}{5} = \frac{15}{5} = 3 \]
  2. Sorted 1, 1, 2, 3, 8: the middle (third) value is the median, 2.
  3. Mode: 1 appears twice, everything else once.
  4. Mean 3, median 2, mode 1. The 8 pulls the mean above the median.
Defects per shift: classify, centre, spread, quartiles, interpret

Eight shifts: 3, 5, 6, 6, 7, 9, 10, 14.

  1. Quantitative, discrete (a count).
  2. \[ \bar x = \frac{60}{8} = 7.5 \]
  3. \[ \text{median} = \frac{6+7}{2} = 6.5,\qquad \text{mode} = 6 \]
  4. Deviations −4.5, −2.5, −1.5, −1.5, −0.5, 1.5, 2.5, 6.5; sum of squares 82.
  5. \[ s^2 = \frac{82}{7} = 11.71,\qquad s = 3.42,\qquad \text{range} = 11 \]
  6. Lower half 3, 5, 6, 6 gives \(Q_1 = 5.5\); upper half 7, 9, 10, 14 gives \(Q_3 = 9.5\); IQR 4; fences −0.5 and 15.5, so 14 is not an outlier.
  7. Mean above median because 14 pulls it up: mild right skew. Report the median 6.5 and IQR 4.

The median

The median is the middle value once the data are sorted, so half the values sit below it and half above. Because it only cares about position, an extreme value cannot drag it.

The median splits our data so that 50% of our values are lower and 50% are higher. In order to compute the median, we MUST sort our values first.

Odd number of observations: the number in the direct middle. With 7 observations the median is the fourth value; with 9 it is the fifth.

Even number: the average of the two middle values. With 8 observations, average the fourth and fifth.

For sorted data of size \(n\):

\[ \text{position of the median} = \frac{n+1}{2} \]

Whether we use the mean or median to describe a dataset depends largely on the shape and on whether there are outliers.

Recipe

  1. Sort from smallest to largest.
  2. \[ \text{position} = \frac{n+1}{2} \]
  3. Whole number: that value is the median. Ends in .5: average the two values either side.
Mean, median and mode of 19, 99, 2, 56, 44, 44, 51, 86, 99, 44, 78
  1. Sorted: 2, 19, 44, 44, 44, 51, 56, 78, 86, 99, 99.
  2. Mode: 44 appears three times (99 only twice).
  3. \[ \sum x_i = 622,\qquad n = 11 \]
  4. \[ \bar x = \frac{622}{11} = 56.54 \]
  5. Median position \((11+1)/2 = 6\): the sixth value is 51.
Household size from percentages: median, mode, and is the mean larger?

Sizes 1, 2, 3, 4, 5, 6, 7+ with percentages 28.1, 34.5, 15.8, 12.6, 5.4, 2.1, 1.5.

  1. Cumulative percentages: 28.1, 62.6, 78.4, 91.0, 96.4, 98.5, 100.
  2. The 50% mark is passed at size 2 (28.1% below it, 62.6% at or below), so the median is 2.
  3. Mode: the largest percentage, 34.5%, is size 2.
  4. The mean is larger than the median. The distribution has a long right tail (sizes up to 7+), which pulls the mean up; a right-skewed shape always has mean above median.

The submitted code took the mean and median of the seven percentages themselves. Those are weights, not data: the median household size is a size (2), not a percentage.

Median and \(Q_1\) of 2, 4, 4, 5, 6, 8, 9

With 7 values the median is the fourth: 5. \(Q_1\) is the median of the lower half 2, 4, 4 (the overall median excluded): 4.

The mode

The mode is the value that shows up most often. It is the only centre you can give for labels, and on a histogram it is simply the tallest bar.

The mode is the most frequently observed value. There might be multiple modes or no mode at all.

No mode: all observations occur with the same frequency, e.g. 1, 1, 2, 2, 3, 3, 4, 4. One mode: 1, 2, 2, 2, 2, 3, 4, 4 has mode 2 (four times). Many modes: 1, 2, 3, 3, 3, 4, 5, 6, 6, 6, 7, 8, 9 has modes 3 and 6.

The mode of a distribution is essentially the tallest bar in a histogram. There may be multiple modes depending on the number of peaks (bimodal, multimodal).

If every value appears once, there is no mode (not "every value is a mode"). The dogs data 5, 3, 8, 3, 15, 45, 9 has mode 3.

Number of pets owned by students: what is the mode most useful for?

(a) Measuring centre for skewed data. (b) Measuring variability. (c) Identifying the most common number of pets. (d) Calculating probability.

(c). The mode answers "which value is most common". For skewed data the median is the usual centre.

Part 3

Measures of spread

Range, quartiles and IQR, then variance and standard deviation.

Range, quartiles and percentiles

Quartiles cut the sorted data into four equal parts and percentiles into a hundred. Together with the minimum and maximum they give the five-number summary, a quick sketch of where the data sit.

Measures of spread: range, interquartile range (IQR), standard deviation, variance.

The range is the smallest number subtracted from the largest. For 9, 3, 44, 15, 6 the range is \(44 - 3 = 41\).

The five-number summary: minimum; \(Q_1\), the value such that 25% of the data fall below; \(Q_2\), the median, 50% below; \(Q_3\), 75% below; maximum. First quartile = lower quartile = 25th percentile. Third quartile = upper quartile = 75th percentile.

For data sorted in ascending order (L2 s4–5):

\[ Q_1 = \text{value at position } \tfrac{1}{4}(n+1) \] \[ Q_3 = \text{value at position } \tfrac{3}{4}(n+1) \] \[ P_k = \text{value at position } \tfrac{k}{100}(n+1),\quad k = 1, 2, \dots, 99 \]

Interpolation is often applied if the position is not an integer. Write the position as \(L = i + f\) with whole part \(i\) and fraction \(f\); then (handout)

\[ Q = x_i + f\,(x_{i+1} - x_i) \]

If \(f = 0\) the quartile is simply \(x_i\).

\(Q_1, Q_2, Q_3\)
first, second (median), third quartile
\(P_k\)
the \(k\)-th percentile: \(k\%\) of the data lie below it
\(L = i + f\)
target position, split into whole part and fraction
\(x_i\)
the \(i\)-th value of the sorted data

The lecture formula (position \(\tfrac{k}{4}(n+1)\), then interpolate) is the one on L2 s4 and in the handout. The instructor's answer keys use a different recipe: the median of each half of the sorted data, excluding the overall median when \(n\) is odd. That is what L1 s55 example 2, the practice-sheet solutions (B1, B2), and the review (p7, p8, p10, p15) all do.

The two agree whenever \(n+1\) is divisible by 4 (\(n = 3, 7, 11, 15, \dots\)) and often elsewhere, but not always: for \(n = 10\) the quiz scores in A1 B1 give \(Q_1 = 11\) by halves and \(10.75\) by interpolation. In an exam, say which recipe you used. If the question says "interpolate", use the formula.

Recipe A: medians of the halves (answer-key method)

  1. Sort. Find the median.
  2. Lower half: all values below the median position (drop the median itself if \(n\) is odd).
  3. \[ Q_1 = \text{median of the lower half} \]
  4. \[ Q_3 = \text{median of the upper half} \]

Recipe B: position and interpolation (lecture formula)

  1. \[ L = \tfrac{1}{4}(n+1) \text{ for } Q_1,\qquad L = \tfrac{3}{4}(n+1) \text{ for } Q_3 \]
  2. Split \(L = i + f\).
  3. \[ Q = x_i + f\,(x_{i+1} - x_i) \]
Interpolated quartiles of 55, 60, 65, 70, 72, 75, 80, 85, 90, 95
  1. Median position \(11/2 = 5.5\):
  2. \[ \text{median} = \frac{72 + 75}{2} = 73.5 \]
  3. \[ L_1 = \tfrac{1}{4}(11) = 2.75 = 2 + 0.75 \]
  4. \[ Q_1 = 60 + 0.75\,(65 - 60) = 63.75 \]
  5. \[ L_3 = \tfrac{3}{4}(11) = 8.25 = 8 + 0.25 \]
  6. \[ Q_3 = 85 + 0.25\,(90 - 85) = 86.25 \]
  7. \[ \text{IQR} = 86.25 - 63.75 = 22.5 \]
  8. Recipe A on the same data gives \(Q_1 = 65\), \(Q_3 = 85\), IQR 20.
Add a score of 100: the positions become whole numbers
  1. \[ \text{median position} = \frac{12}{2} = 6 \quad\Rightarrow\quad x_6 = 75 \]
  2. \[ L_1 = \tfrac{1}{4}(12) = 3 \quad\Rightarrow\quad Q_1 = x_3 = 65 \]
  3. \[ L_3 = \tfrac{3}{4}(12) = 9 \quad\Rightarrow\quad Q_3 = x_9 = 90 \]
  4. \[ \text{IQR} = 90 - 65 = 25 \] Recipe A gives the same numbers here.
Five-number summaries of 1, 2, 3, 3, 5, 8, 10 and of the same data plus 105
  1. Example 1 (\(n = 7\)): min 1, \(Q_1 = 2\), median 3, \(Q_3 = 8\), max 10. Both recipes agree.
  2. Example 2 (\(n = 8\)): 1, 2, 3, 3, 5, 8, 10, 105. Median \((3+5)/2 = 4\).
  3. Lower half 1, 2, 3, 3 gives \(Q_1 = 2.5\); upper half 5, 8, 10, 105 gives \(Q_3 = 9\). This is what the slide shows (Recipe A). Recipe B would give 2.25 and 9.5.
  4. The 105 changes the maximum and the range (104) but not the quartiles. Position-based measures resist outliers.
The 90th percentile of 15 values by interpolation
  1. Sorted: 3.6, 4, 4.5, 4.5, 5.7, 5.9, 6, 6.5, 7.1, 7.8, 8, 8.1, 9, 9.2, 9.4.
  2. \[ L = \frac{90}{100}(15+1) = 14.4 \]
  3. \[ P_{90} = 9.2 + 0.4\,(9.4 - 9.2) = 9.28 \]
Range, \(Q_1\), \(Q_3\), median of 1, 5, 10, 3, 8, 12, 4, 1, 2, 8
  1. Sorted: 1, 1, 2, 3, 4, 5, 8, 8, 10, 12. Range \(12 - 1 = 11\).
  2. \[ \text{median} = \frac{4+5}{2} = 4.5 \]
  3. Recipe A: lower half 1, 1, 2, 3, 4 gives \(Q_1 = 2\); upper half 5, 8, 8, 10, 12 gives \(Q_3 = 8\); IQR 6 (the review's answer).
  4. Recipe B: \(L_1 = 2.75\) gives \(1 + 0.75(2-1) = 1.75\); \(L_3 = 8.25\) gives \(8 + 0.25(10-8) = 8.5\); IQR 6.75.
  5. Either way the fences (−7 and 17, or −8.4 and 18.6) contain all the data: no outliers.
Same for 5, 10, 3, 8, 12, 4, 1, 2, 8
  1. Sorted: 1, 2, 3, 4, 5, 8, 8, 10, 12 (\(n = 9\)). Range 11. Median \(x_5 = 5\).
  2. Recipe A: lower half 1, 2, 3, 4 gives \(Q_1 = 2.5\); upper half 8, 8, 10, 12 gives \(Q_3 = 9\).
  3. Recipe B: \(L_1 = 2.5\) gives \((2+3)/2 = 2.5\); \(L_3 = 7.5\) gives \((8+10)/2 = 9\). Same answer.
Five-number summary of quiz scores 8, 10, 11, 13, 14, 14, 15, 17, 18, 19
  1. Already sorted, \(n = 10\). Min 8, max 19.
  2. \[ \text{median} = \frac{14+14}{2} = 14 \]
  3. Recipe A: lower half 8, 10, 11, 13, 14 gives \(Q_1 = 11\); upper half 14, 15, 17, 18, 19 gives \(Q_3 = 17\).
  4. Recipe B: \(L_1 = 2.75\) gives \(10 + 0.75(1) = 10.75\); \(L_3 = 8.25\) gives \(17 + 0.25(1) = 17.25\).
  5. Summary: (8, 11, 14, 17, 19) by the answer-key recipe, or (8, 10.75, 14, 17.25, 19) by interpolation. The submitted assignment used interpolation (numpy's "weibull" method).
Five-number summary and boxplot of 51, 56, 61, 66, 68, 71, 74, 76, 81, 86, 91
  1. \(n = 11\), median position 6: median 71.
  2. Lower half 51, 56, 61, 66, 68 gives \(Q_1 = 61\); upper half 74, 76, 81, 86, 91 gives \(Q_3 = 81\) (interpolation agrees: positions 3 and 9).
  3. \[ \text{IQR} = 20,\qquad \text{fences } 61 - 30 = 31 \text{ and } 81 + 30 = 111 \] No outliers.
  4. Box from 61 to 81, line at 71, whiskers to 51 and 91. \(Q_1\) and \(Q_3\) are each 10 from the median and both whiskers are 10 long: symmetric, and indeed mean \(= 781/11 = 71 =\) median.

IQR, the 1.5 × IQR rule and the boxplot

A boxplot draws the five-number summary: a box from the first to the third quartile with the median inside, and whiskers out to the data. Any point further than one and a half box-widths from the box is drawn alone, as an outlier.

The interquartile range is the difference between the upper and lower quartiles:

\[ \text{IQR} = Q_3 - Q_1 \]

A value can be considered an outlier if it falls more than 1.5 times the IQR above the upper quartile or below the lower quartile:

\[ \text{lower fence} = Q_1 - 1.5\,\text{IQR} \] \[ \text{upper fence} = Q_3 + 1.5\,\text{IQR} \]

Boxplot, step by step: sort and find \(Q_1\), the median and \(Q_3\); compute the IQR; compute the fences; draw a box from \(Q_1\) to \(Q_3\) with a line at the median; extend whiskers to the most extreme points that fall within the fences; plot any points beyond the fences individually as outliers.

The whisker end is NOT always the true minimum or maximum. If a point sits beyond a whisker, that point, not the whisker, marks the actual extreme. Wider boxes and whiskers mean more spread; a narrow box means the middle 50% is tightly packed.

Reading a boxplot (L1 s94, L2 s50): minimum at the tip of the left whisker (about 0.75), \(Q_1\) at the left edge of the box (2.5), median at the line (6.5), \(Q_3\) at the right edge (12), maximum at the right whisker (16).

Boxplot with min 28, Q1 41, median 45, Q3 49, max 60 and one outlier dot beyond the whisker
L2 s39: boxplot anatomy. The whisker stops at 60, the last point inside the fence; the dot beyond it is an outlier.

For a bell-shaped variable the fences sit about 2.7 standard deviations from the centre, so fewer than 1% of ordinary values get flagged. It is a convention, not a law: flagging a point says "look at this", not "delete this".

Recipe: boxplot with outliers

  1. Sort; find \(Q_1\), median, \(Q_3\).
  2. \[ \text{IQR} = Q_3 - Q_1 \]
  3. \[ \text{fences} = Q_1 - 1.5\,\text{IQR},\quad Q_3 + 1.5\,\text{IQR} \]
  4. Mark every value outside the fences as an outlier.
  5. Whiskers run to the smallest and largest values that are still inside the fences.
Apples sold per day: 22, 23, 24, 24, 25, 25, 26, 26, 27, 28, 60
  1. \(n = 11\): median \(x_6 = 25\); lower half gives \(Q_1 = 24\); upper half gives \(Q_3 = 27\).
  2. \[ \text{IQR} = 27 - 24 = 3 \]
  3. \[ \text{fences} = 24 - 4.5 = 19.5,\quad 27 + 4.5 = 31.5 \]
  4. 60 lies above 31.5: an outlier. Whiskers stop at 22 and 28.
Seventeen values with −12 and 45 at the ends
  1. Sorted: −12, 3.6, 4, 4.5, 4.5, 5.7, 5.9, 6, 6.5, 7.1, 7.8, 8, 8.1, 9, 9.2, 9.4, 45.
  2. Median \(x_9 = 6.5\). Lower half (8 values) gives \(Q_1 = (4.5+4.5)/2 = 4.5\); upper half gives \(Q_3 = (8.1+9)/2 = 8.55\). Interpolation gives the same.
  3. \[ \text{IQR} = 4.05,\qquad 1.5\,\text{IQR} = 6.075 \]
  4. \[ \text{fences} = -1.575 \text{ and } 14.625 \]
  5. −12 and 45 are outliers. Whiskers stop at 3.6 and 9.4.
Boxplot and outlier check for the quiz scores of B1
  1. Answer-key recipe: \(Q_1 = 11\), \(Q_3 = 17\), IQR 6.
  2. \[ \text{fences} = 11 - 9 = 2,\quad 17 + 9 = 26 \]
  3. All scores lie in 8 to 19: no outliers. Box 11 to 17, line at 14, whiskers to 8 and 19.
  4. With interpolation (\(Q_1 = 10.75\), \(Q_3 = 17.25\), IQR 6.5) the fences are 1 and 27: same conclusion.
Interpret quartiles and IQR for commute times (16, 22, 26, 31, 43)
  1. About 25% of the metro areas average 22 minutes or less; 50% average 26 or less; 75% average 31 or less.
  2. \[ \text{IQR} = 31 - 22 = 9 \] The middle half of areas commute between 22 and 31 minutes.
  3. \[ \text{fences} = 22 - 13.5 = 8.5,\quad 31 + 13.5 = 44.5 \] Both 16 and 43 are inside, so no outliers: box 22 to 31, line at 26, whiskers to 16 and 43.
  4. The upper whisker (12 long) is longer than the lower (6): a mild right skew.
Campus traffic over 11 days: summary, boxplot, outliers

370, 390, 420, 460, 470, 480, 495, 505, 510, 530, 750.

  1. \[ \bar x = \frac{5380}{11} = 489.09,\qquad \text{median} = x_6 = 480 \]
  2. \[ s = \sqrt{\frac{100{,}540.9}{10}} = 100.27 \] (sample SD; see Variance)
  3. Lower half gives \(Q_1 = 420\); upper half gives \(Q_3 = 510\). Summary (370, 420, 480, 510, 750).
  4. \[ \text{IQR} = 90,\qquad \text{fences } 285 \text{ and } 645 \]
  5. 750 is an outlier; whiskers to 370 and 530. The median sits in the upper part of the box and the outlier is on the right: right-skewed.
Which statement about a five-number summary is true?

A1 A3: battery life (4, 6, 8, 11, 20). (A) About 25% between 4 and 6 h. (B) About 50% between 6 and 11 h. (C) IQR is 5 h. (D) All of the above. Practice A4: scores (50, 65, 75, 85, 100): 25% between 50 and 65? IQR 20? median 75? all?

Both: all of the above. Min to \(Q_1\) holds a quarter, \(Q_1\) to \(Q_3\) holds half, and the IQR is \(Q_3 - Q_1\) (\(11 - 6 = 5\); \(85 - 65 = 20\)).

Two labs' five-number summaries: who is more consistent, is 30 an outlier, which mean is larger?

Lab A: (2, 4, 6, 8, 12). Lab B: (0, 5, 6, 7, 30). A manager says B is more consistent.

  1. \[ \text{IQR}_A = 4,\qquad \text{IQR}_B = 2 \] B's middle half is tighter.
  2. \[ \text{range}_A = 10,\qquad \text{range}_B = 30 \] B has the wider overall spread. "More consistent" needs a named measure.
  3. \[ \text{upper fence}_B = 7 + 1.5(2) = 10 \] 30 is flagged. Flagging means investigate, not delete: an unusual but valid value stays.
  4. The means cannot be found from five numbers. Equal medians do not imply equal means, and a larger maximum alone does not make the mean larger.

Variance and standard deviation

The variance is the average squared distance of the values from their mean, and the standard deviation is its square root, which brings it back into the original units. Both get bigger when the data are more spread out.

The variance is the average squared difference of each observation from the mean:

\[ \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar x)^2 \]

The standard deviation is the square root of the variance:

\[ \sqrt{\frac{1}{n}\sum_{i=1}^{n}(x_i - \bar x)^2} \]

The standard deviation has the same units as the original data, while the units of the variance are the square of those units (dollars versus dollars squared). The standard deviation is, on average, how far each point in our dataset is from the mean.

Benefits of a single metric instead of the five-number summary: it simplifies the amount of information needed, and it is useful for inferential statistics.

Final points: higher variance means more spread, but an outlier may be inflating it; compare spreads only in the same units; in money matters higher variance means higher risk; the standard deviation is used more in practice because it shares the units of the data.

Symbols (L3 s19–20): \(S\) is the sample standard deviation (a sample statistic), \(\sigma\) the standard deviation of the entire population (a parameter). The sample standard deviation \(s\), divided by \(n-1\), estimates \(\sigma\).

\(x_i - \bar x\)
deviation of one value from the mean; the deviations always sum to zero
\(\sigma^2,\ \sigma\)
population variance and SD: divide by \(N\)
\(s^2,\ s\)
sample variance and SD: divide by \(n - 1\)

L1 s59–60 divide by \(n\) (population formula). The review's formula sheet and every answer key for this course (practice sheet B1, review p8) divide by \(n - 1\) (sample formula). The L1 s65 matching answer 33.9 is the \(n\) version; with \(n - 1\) it would be 36.8.

Rule: "population", "all", "every" in the question means \(N\); "sample" or data drawn from a larger group means \(n - 1\). If the wording is silent, use \(n - 1\) and say so.

Recipe

  1. Mean.
  2. Each deviation \(x_i - \bar x\). Check they sum to 0.
  3. Square each deviation; add them up.
  4. \[ s^2 = \frac{\text{sum of squares}}{n - 1}\quad\text{or}\quad \sigma^2 = \frac{\text{sum of squares}}{N} \]
  5. \[ s = \sqrt{s^2} \]
Variance and SD of 10, 14, 10, 6
  1. \[ \bar x = \frac{40}{4} = 10 \]
  2. Deviations: 0, 4, 0, −4 (they add to 0). Squares: 0, 16, 0, 16.
  3. \[ \sigma^2 = \frac{0+16+0+16}{4} = \frac{32}{4} = 8 \]
  4. \[ \sigma = \sqrt 8 = 2.83 \]
  5. Sample version: \(s^2 = 32/3 = 10.67\), \(s = 3.27\).
Match (33.9, 10.5, 2, 20, 22, 5.8) to IQR, range, variance, SD, min, max

Data: 15, 4, 3, 8, 15, 22, 7, 9, 2, 3, 3, 12, 6.

  1. Sorted: 2, 3, 3, 3, 4, 6, 7, 8, 9, 12, 15, 15, 22. Min 2, max 22, range 20.
  2. Median \(x_7 = 7\); lower half gives \(Q_1 = 3\); upper half gives \(Q_3 = 13.5\); IQR 10.5.
  3. \[ \bar x = \frac{109}{13} = 8.385 \]
  4. \[ \sigma^2 = \frac{\sum x_i^2}{N} - \bar x^2 = \frac{1355}{13} - 70.30 = 33.9 \]
  5. \[ \sigma = \sqrt{33.9} = 5.8 \]
  6. So: IQR 10.5, range 20, variance 33.9, SD 5.8, min 2, max 22. These are the population (divide by 13) values; the sample variance would be 36.8.
d1 has SD 5, d2 has variance 36 (same units): what is certainly true? And if SD = 0?
  1. \[ \text{var}(d_1) = 25 \lt 36 = \text{var}(d_2),\qquad \text{SD}(d_2) = 6 \gt 5 \] Only the two spread statements are certain. The SD says nothing about the mean, the median, or even the range.
  2. SD = 0 means every value equals the mean: all data points are the same (not necessarily zero).
Ten days of traffic: mean, median, SD and five-number summary

420, 510, 390, 460, 550, 480, 505, 495, 470, 530.

  1. Sorted: 390, 420, 460, 470, 480, 495, 505, 510, 530, 550.
  2. \[ \bar x = \frac{4810}{10} = 481,\qquad \text{median} = \frac{480+495}{2} = 487.5 \]
  3. Sum of squared deviations 21,340.
  4. \[ s = \sqrt{\frac{21{,}340}{9}} = 48.69 \] (population SD 46.20)
  5. Halves: \(Q_1 = 460\), \(Q_3 = 510\); summary (390, 460, 487.5, 510, 550). Interpolation: \(Q_1 = 450\), \(Q_3 = 515\).
  6. IQR 50, fences 385 and 585: no outliers. Mean below median: slight left skew.

What happens to mean, variance and SD when you rescale the data

Adding a constant slides every value, so the centre moves but the spread does not. Multiplying stretches the spread too: the SD scales by the factor, the variance by its square.

For \(Y = aX + b\):

\[ \bar y = a\,\bar x + b \] \[ s_y^2 = a^2 s_x^2 \] \[ s_y = |a|\,s_x \]

Every deviation \(y_i - \bar y = (x_i + b) - (\bar x + b) = x_i - \bar x\) is unchanged, so the squares and their average are unchanged. Multiplying by \(a\) multiplies every deviation by \(a\), every squared deviation by \(a^2\).

Multiply every value by \(c \gt 0\); then the case mean 50, variance 16, SD 4, \(c = 2\)
  1. \[ \mu' = c\mu,\qquad \sigma'^2 = c^2\sigma^2,\qquad \sigma' = c\sigma \]
  2. \[ \mu' = 100,\qquad \sigma'^2 = 4 \times 16 = 64,\qquad \sigma' = 8 \]
Add 10 to every value: effect on mean, variance, SD, and why

Mean rises by 10. Variance and SD are unchanged, because every value moves by the same amount, so every distance from the mean stays exactly as it was. Check on 2, 3, 5, 9, 13: mean 6.4, population SD 4.079; after adding 10, mean 16.4, SD still 4.079.

Mean 20, SD 5, \(Y = 2X + 3\): mean and SD of \(Y\)
  1. \[ \bar y = 2(20) + 3 = 43 \]
  2. \[ s_y = 2 \times 5 = 10 \] The +3 does not touch the SD.

Part 4

Shape and outliers

Which centre to report, and what to do with points that do not fit.

Shape: symmetric, right-skewed, left-skewed

The shape of a histogram tells you which centre to trust. A long tail drags the mean towards it, so for skewed data report the median; for symmetric data the mean and median agree.

From a histogram we can quickly identify the shape of our data, which influences all of the measures learned so far. Three shapes: right-skewed, left-skewed, symmetric (frequently normally distributed).

Skew is named for the tail, not the peak.

ShapeMean vs medianReal-world examples
Symmetric (normal)mean = median (= mode)height, weight, measurement error, precipitation
Right-skewedmean \(\gt\) median (mode \(\lt\) median \(\lt\) mean)drug remaining in the bloodstream, time between calls, time until a bulb dies, household income
Left-skewedmean \(\lt\) median (mean \(\lt\) median \(\lt\) mode)exam grades (%) at many universities, age at death, asset price changes

Symmetric: left and right halves are mirror images; "normally distributed" when also bell-shaped. Right-skewed: most values cluster on the left and a long tail of high values pulls the mean above the median. Left-skewed: the mirror image.

Rule of thumb: when a distribution is skewed, lead with the median. When it is roughly symmetric, mean and median tell the same story. Symmetric, bell-shaped data is what lets us apply normal-distribution methods (z-scores, the CLT) with confidence.

Three density curves: left-skewed with mean below median below mode, symmetric with all equal, right-skewed with mode below median below mean
Review p14: the mean (solid) is pulled furthest into the tail, the mode (dotted) sits under the peak, the median (dashed) lies between.

Picture the tail as a lever: the few extreme values in the tail have long arms, so they tip the mean their way. The median only counts heads, so it barely notices them.

Mean = median does not prove symmetry, and symmetry does not prove normality: a flat (uniform) distribution is symmetric but not bell-shaped (L2 s61 Q5). The converse is true: normal data always have mean = median.

Minutes between calls: 2, 3, 3, 4, 4, 5, 5, 6, 8, 15
  1. \[ \text{median} = \frac{4+5}{2} = 4.5 \]
  2. \[ \bar x = \frac{55}{10} = 5.5 \]
  3. Mean above median: the 15-minute gap pulls the mean up. Right-skewed, so report the median.
Shape quiz: mean vs median for each shape, and two true/false questions

Q1–3: right-skewed, left-skewed, symmetric. Q4: normal data must have mean = median. Q5: mean = median means the data are normal.

Right-skewed: mean greater than median. Left-skewed: mean less than median. Symmetric: equal. Q4 true (the normal curve is symmetric). Q5 false (symmetric is not the same as bell-shaped; a uniform distribution is a counterexample).

Mean 38 and median 29 (or mean 50 and median 40): what shape?

Right-skewed in both cases. The mean sits above the median, so the tail is on the high side.

Exercise 1: name the plot and its shape
Histogram of petal length with one peak around 1 to 2 cm and another around 4 to 6 cm
L2 s55: petal length in cm.

Histogram (touching bars over a continuous variable). Bimodal: two distinct peaks, one near 1–2 cm and one near 4–6 cm, with a dip between.

Exercise 2: name the plot, its shape, and compare mean to median
Horizontal boxplot from about -8 to 5 with three outlier dots near -15 and -13
L2 s56.

Box plot. Left-skewed: the long whisker and the outlier points sit on the left, and the median line is left of the box centre. So the mean is less than the median.

Exercise 3: which histogram does each statement describe?
Histogram 1 falls steeply from a peak near 0 out to 1600; Histogram 2 rises from 2 to a peak near 5.5 then falls by 7
L2 s57: Histogram 1 (left) and Histogram 2 (right).

Mean greater than the median · higher variance · bin width 0.5 · range about 5.5 · left-skewed · mean about equal to the median.

  1. Mean \(\gt\) median: Histogram 1 (strong right skew).
  2. Higher variance: Histogram 1 (spans roughly 0 to 1,800 against 2 to 7.5).
  3. Bin width 0.5: Histogram 2 (bars at 2, 2.5, 3, …; Histogram 1's bins are about 200 wide).
  4. Range about 5.5: Histogram 2 (2 to 7.5).
  5. Left-skewed: Histogram 2 (mass at the high end, trailing off to the left).
  6. Mean about equal to median: neither; both are clearly skewed.

Outliers: what they do and what to do about them

An outlier is a point far away from the rest. It can swing the mean and the standard deviation a lot, while the median and the IQR barely move, which is why you report the five-number summary when outliers are around.

Outliers are points that fall very far from the rest of the data. They influence measures like the mean and standard deviation much more than measures associated with the five-number summary.

Example: annual earnings of entrepreneurs, 45, 68, 92, 53, 105, 56, 24, 15, 155 thousand dollars, and then the Meta CEO at 1.6 billion.

Common techniques when outliers are present: 1. note that they exist and their impact on summary statistics; 2. if a typo, remove or fix; 3. understand why they exist and the impact on the questions you are asking; 4. report the five-number summary rather than mean and SD; 5. be careful in reporting and ask the right questions.

Iris sepal length (L2 s40, s44): 50 flowers per species. Virginica: \(Q_1 \approx 6.2\), \(Q_3 \approx 6.9\), IQR 0.7, lower fence about 5.2; one virginica flower at 4.9 cm is below the fence, so it is plotted as an outlier and the whisker is not the minimum. Setosa has the smallest IQR (about 0.4), median about 5, and is approximately symmetric. Virginica has the largest sepals on average.

Three boxplots of sepal length: setosa around 5, versicolor around 5.9, virginica around 6.5 with one low outlier
L2 s40: sepal length by species (cm). The boxes barely overlap.
Seven statements about the iris boxplots: true or false?

Which species has the smallest IQR? Setosa has the largest range. Setosa's median is about 5. Setosa has the largest sepals on average. All setosa flowers are shorter than all versicolor flowers. More than 70% of virginica flowers are longer than the longest setosa flower. More flowers were measured for versicolor than virginica.

  1. Smallest IQR: setosa (about 0.4 cm against 0.7 for the others).
  2. Largest range: false; setosa's range (4.3 to 5.8, about 1.5) is the smallest.
  3. Median about 5: true.
  4. Largest sepals: false; virginica has the largest, setosa the smallest.
  5. All setosa shorter than all versicolor: false; setosa's max (5.8) exceeds versicolor's min (4.9), so the ranges overlap.
  6. More than 70% of virginica above 5.8: true; virginica's \(Q_1 \approx 6.2\) is already above 5.8, so at least 75% exceed it.
  7. More versicolor than virginica: false; 50 per species. Box or whisker size says nothing about sample size.
Three sections' score boxplots: five-number summaries, best typical performance, most variability, symmetry

Read from the plot: Alpha (50, 65, 75, 85, 95), Beta (45, 55, 60, 80, 100), Gamma (60, 70, 80, 90, 100).

  1. IQR: Alpha 20, Beta 25, Gamma 20. Range: Alpha 45, Beta 55, Gamma 40.
  2. Typical performance (medians 75, 60, 80): Gamma highest, Beta lowest.
  3. Variability: Beta most (largest IQR and range); Gamma most consistent.
  4. Symmetry: Alpha and Gamma have median − \(Q_1\) = \(Q_3\) − median = 10, roughly symmetric. Beta has 5 below and 20 above: right-skewed, with a long upper tail.

Part 5

Charts and tables

Pick the chart from the question you are asking, then build it from a frequency table.

Choosing the right chart

Start from the question, not from the chart you like. Categories want bars or a pie, one numeric variable wants a histogram or boxplot, two numeric variables want a scatterplot.

Your questionChartKey construction rule
Compare categories?Bar chartbar height = category value; bars separated
See the shape of a distribution?Histogram\(k = 1 + 3.322\log_{10} n\); \(w = \text{range}/k\); bars touch
Show parts of a whole?Pie chartangle = (value / total) × 360°; five slices or fewer
Compare spread and spot outliers?BoxplotIQR = \(Q_3 - Q_1\); fences at \(Q_1/Q_3 \mp 1.5\,\)IQR
See a relationship between two variables?Scatterplotexplanatory on \(x\), response on \(y\); \(r\) measures linearity
Shape plus every exact value, small \(n\)?Stem-and-leafvalue = stem × 10 + leaf; add a key

A good graph accurately shows the facts, grabs attention, complements the text, has a title and labels, is simple and uncluttered, shows data without altering the message, clearly shows trends or differences, and is visually accurate: if one value is 15 and another 30, the 30 should look twice as big.

Categorical variables are best displayed in a bar chart or pie chart; continuous variables such as height by a line chart or histogram. Tip: pair a histogram with a boxplot for the same variable.

A histogram or boxplot of a categorical variable is meaningless (there is no number line to bin). A bar chart of a continuous variable with hundreds of distinct values is unreadable: bin it into a histogram instead.

Which display? Shape of one quantitative variable; proportions preferring four coffee brands; study hours vs exam score; budget shares; three sections with outliers; 200 sensor readings
  1. Shape of one quantitative variable: histogram.
  2. Four brands' proportions: bar chart (pie also acceptable for a share of a whole).
  3. Study hours vs score: scatterplot (two paired quantitative variables).
  4. Budget shares across four departments: pie chart.
  5. Exam-score spread in three sections with outliers: side-by-side boxplots.
  6. 200 sensor readings: histogram.
Walking 24, Bicycle 12, Bus 15, Car 9: draw the chart, and which display is wrong for it?

A bar chart with four separated bars of heights 24, 12, 15, 9 (walking tallest, car shortest). A histogram would be inappropriate because mode of transport is nominal categorical data: there is no numeric axis to bin. A boxplot fails for the same reason.

Bar chart

One bar per category, with the bar's height showing its count or value. Gaps between the bars remind you the categories are separate things.

A bar chart represents categorical data with rectangular bars whose length is proportional to the value. Use it to compare values across a small number of discrete categories, to rank groups, when the data are nominal or ordinal. Steps: identify categories and their values; categories on one axis, values on the other; scale the value axis to fit the largest bar; one bar per category, same width, evenly spaced; label both axes and add a title; optionally sort by value when ranking matters.

Bar chart vs histogram: bar chart for categorical or discrete data, bars separate; histogram for continuous data grouped into intervals, bars touch. A grouped bar chart compares two series (boys and girls with smartphones, 2012–2019).

Fruit sold at the Saturday market

Apples 12, Bananas 18, Cherries 7, Dates 4, Mangoes 15 baskets. Value axis 0–20, leaving headroom above the tallest bar (18). One bar per fruit, equal width, evenly spaced.

Histogram and Sturges' rule

A histogram chops the number line into equal bins and draws a touching bar for the count in each. The bins are a choice; Sturges' rule gives a sensible default number of them.

Histograms are the most common visual for quantitative data. Each bin represents a range of values; the number of values in the range determines the bar height. Use it to understand shape (skew, modality, spread), to check whether data look roughly normal before using CLT-based methods, and to spot gaps or outlying values.

Steps: find the minimum and maximum (the range); choose the number of bins \(k\), Sturges' rule gives a default:

\[ k = 1 + 3.322\,\log_{10}(n) \]

Compute the bin width:

\[ w = \frac{\max - \min}{k} \]

Tally the points in each bin; draw bars touching with height equal to the frequency; label the bin boundaries.

Round the width up, never down, or the last bin misses the maximum. Sturges' \(k\) is rounded to the nearest whole number on the slides (5.32 became 5) and up in the review (6.64 became 7); either is accepted, but say what you did.

Weights of 20 apples, 128 g to 155 g
  1. \[ \text{range} = 155 - 128 = 27 \text{ g} \]
  2. \[ k = 1 + 3.322\log_{10} 20 = 5.32 \quad\Rightarrow\quad 5 \text{ bins} \]
  3. \[ w = \frac{27}{5} = 5.4 \quad\Rightarrow\quad 6 \text{ g} \]
  4. Bins 128–134, 134–140, 140–146, 146–152, 152–158 with the slide's frequencies 6, 5, 5, 4, 2.

Those frequencies add to 22, not 20. The slide's table is inconsistent with its own \(n\); the method is what matters.

Histogram with 5 equal bins for 3, 7, 9, 12, 15, 18, 20, 24, 27, 30; comment on shape
  1. \[ w = \frac{30 - 3}{5} = 5.4 \]
  2. Bins [3, 8.4), [8.4, 13.8), [13.8, 19.2), [19.2, 24.6), [24.6, 30]: counts 2, 2, 2, 2, 2.
  3. Every bar is the same height: a uniform (flat) distribution, symmetric, no skew, no outliers.
50 values from 12 to 87: how many bins and what width?
  1. \[ k = 1 + 3.322\log_{10} 50 = 6.64 \quad\Rightarrow\quad 7 \text{ bins} \]
  2. \[ w = \frac{87 - 12}{7} = 10.7 \quad\Rightarrow\quad 11 \]
Five-bin histograms for the 11-day and 10-day traffic data
  1. 11 days (370 to 750): \[ w = \frac{380}{5} = 76 \] Bins [370, 446), [446, 522), [522, 598), [598, 674), [674, 750]: counts 3, 6, 1, 0, 1. Peak in the second bin, a gap, then one high value: right-skewed, matching the boxplot.
  2. 10 days (390 to 550): \[ w = \frac{160}{5} = 32 \] Bins [390, 422), [422, 454), [454, 486), [486, 518), [518, 550]: counts 2, 0, 3, 3, 2. Roughly symmetric with a gap in the second bin.

Pie chart

A pie shows how one whole splits into parts. Each slice's angle is its share of 360 degrees, so it only works when the parts really do add up to a whole.

A circular chart divided into slices; each slice's angle and area are proportional to the category's share of the whole. Use it for composition, not comparison, with five or fewer categories. Steps: add up the values; proportion = value ÷ total; angle = proportion × 360°; draw the slices; label with name and percentage; group small ones into "Other".

\[ \text{slice angle} = \frac{\text{category value}}{\text{total}} \times 360^\circ \]
The market fruit as a pie
  1. \[ \text{total} = 12 + 18 + 7 + 4 + 15 = 56 \]
  2. \[ \text{bananas: } \frac{18}{56} = 0.321 = 32\% \]
  3. \[ \text{angle} = 0.321 \times 360^\circ = 116^\circ \]
  4. Shares: apples 21%, bananas 32%, cherries 13%, dates 7%, mangoes 27%.

Scatterplot (and line chart)

A scatterplot puts one dot per pair of measurements, so you can see whether two numeric variables move together. A line chart joins the dots when the x-axis is time.

A scatterplot plots paired \((x, y)\) observations to visualise the relationship between two quantitative variables: whether they are associated, whether the relationship is linear before fitting a regression, and whether there are clusters or outliers. Put the explanatory variable on \(x\) and the response on \(y\). Look for positive, negative or no association, linear or curved. Optionally compute the correlation coefficient \(r\) or fit a trend line.

Apple weight vs price: 110 g at $0.45 up to 155 g at $0.68. Points trend upward: heavier apples cost more, a positive association.

Line charts are more popular than all other graphs combined because they reveal trends clearly; a line chart is often viewed as a time-series graph.

The correlation coefficient \(r\) on L2 s25 is explained with a worked example on the next page, under Association vs correlation.

Stem-and-leaf display

Split each number into a stem (the leading digits) and a leaf (the last digit), then list the leaves beside their stem. You get a histogram turned on its side that still shows every exact value.

\[ \text{value} = \text{stem} \times 10 + \text{leaf} \]

Steps: sort; choose the stem (leading digits) and leaf (last digit); list each stem once, increasing, down the left; attach each value's leaf in increasing order; add a key such as \(6 \mid 3 = 63\); read the shape sideways. Best for small to moderate datasets (under 100) where preserving the raw data matters.

Apples example: stem 12 has leaf 8 (128 g); stem 13 has 0 2 3 5 6 7 8 9; stem 14 has 1 2 3 4 5 7 8 9; stem 15 has 0 2 5. Key: \(12 \mid 8 = 128\) grams.

Pictographs and visual distortion

A pictograph uses little pictures instead of bars. When the pictures are scaled in two dimensions, a value twice as big looks four times as big, which misleads.

A pictograph uses picture symbols to illustrate statistical information. It is often more difficult to visualise data precisely, so pictographs should be used carefully to avoid misrepresenting data, accidentally or deliberately. Problem: visual distortion, larger icons attract more attention and make differences seem bigger than they are.

Frequency tables and cumulative frequency

A frequency table counts how many values fall in each category or class, and a cumulative table keeps a running total as you go up. They are the numbers behind every bar chart and histogram.

Frequency chart for categories: list the distinct categories, count each, convert to percent:

\[ \% = \frac{f}{n} \times 100 \]

Blood types of 20 ER patients: A 5 (25%), B 5 (25%), O 6 (30%), AB 4 (20%).

Frequency distribution table for numbers (IQ scores of 17 children, 118 to 154): choose the number of classes (5); range \(= 154 - 118 = 36\); class width \(= 36/5 = 7.2\), rounded up to 8; add the width to the minimum repeatedly for the class starts (118, 126, 134, 142, 150); upper limits are start + (width − 1), e.g. 118 + 7 = 125; tally into each class: 118–125 (4), 126–133 (6), 134–142 (4), 143–149 (1), 150–157 (2). Plot the histogram.

Cumulative frequency tells how many observations lie at or below a value: add each class's frequency to the running total. The last cumulative value always equals the total sample size.

Rock climbers at Lake Louise over 30 days, classes of 10: 0–9 (1, cum 1), 10–19 (2, 3), 20–29 (3, 6), 30–39 (5, 11), 40–49 (6, 17), 50–59 (9, 26), 60–69 (4, 30). On 11 of the 30 days, 39 or fewer people climbed; on 13 days, 50 or more.

L1 s96's classes 134–142 and 143–149 are 9 and 7 wide. The review (p13) uses 134–141 and 142–149 (counts 3 and 2 instead of 4 and 1). Keep every class the same width and non-overlapping; both versions total 17.

Recipe: grouped frequency table

  1. Choose the number of classes \(k\) (Sturges or as told).
  2. \[ w = \left\lceil \frac{\max - \min}{k} \right\rceil \]
  3. Class starts: min, min + \(w\), min + 2\(w\), … Upper limits: start + \(w - 1\) for whole-number data.
  4. Tally; percent \(= f/n \times 100\); cumulative = running total. Check the last cumulative equals \(n\) and the percents add to 100.
Twelve delivery times, from table to shape
  1. Data: 12, 15, 16, 18, 18, 19, 21, 22, 24, 27, 31, 45.
  2. \[ k = 1 + 3.322\log_{10} 12 = 4.6 \quad\Rightarrow\quad 5 \]
  3. \[ w = \frac{33}{5} = 6.6 \quad\Rightarrow\quad 7 \]
  4. Classes 12–18 (5, 41.7%, cum 5), 19–25 (4, 33.3%, 9), 26–32 (2, 16.7%, 11), 33–39 (0, 0%, 11), 40–46 (1, 8.3%, 12).
  5. \[ \bar x = \frac{268}{12} = 22.3 \gt \text{median} = \frac{19+21}{2} = 20 \] Right-skewed; \(Q_1 = 17\), \(Q_3 = 25.5\), upper fence 38.25, so 45 is an outlier. Report the median.
What percent of the 20 patients were type O? On how many days were there 39 or fewer climbers?
  1. \[ \frac{6}{20} \times 100 = 30\% \]
  2. The cumulative frequency of the 30–39 class is 11 days.

Median from a grouped frequency table

When you only have class counts, you cannot sort the raw values. Instead, find the class that contains the middle observation and assume the values are spread evenly inside it.

With \(N\) observations, median class lower boundary \(L\), class width \(h\), frequency \(f\) of the median class and cumulative frequency \(CF\) of the classes before it:

\[ \text{median} = L + \frac{N/2 - CF}{f}\, h \]

It is not on the slides; the practice-sheet answer key (C2) uses it. It is linear interpolation inside the median class: \(N/2 - CF\) tells how far into the class the middle observation sits, out of the \(f\) values there.

Science-test marks: cumulative table and median

Classes 0–10 (3), 10–20 (7), 20–30 (12), 30–40 (8), 40–50 (5).

  1. Cumulative: 3, 10, 22, 30, 35. Check: \(N = 35\).
  2. \[ \frac{N}{2} = 17.5 \] The cumulative passes 17.5 in the 20–30 class (10 before it, 22 after), so that is the median class.
  3. \[ \text{median} = 20 + \frac{17.5 - 10}{12}\times 10 = 20 + 6.25 = 26.25 \]

Part 6

Exam toolkit

You may bring one A4 formula sheet. The skill tested is choosing the right summary and showing every step.

Which formula, when

The question asks for…UseCard
the type of a variablearithmetic meaningful? smaller unit? order?Data types
the average\(\bar x = \frac1n\sum x_i\)Mean
the middle valuesort, position \((n+1)/2\)Median
the most common valuecount repeats; tallest barMode
\(Q_1\), \(Q_3\), a percentilemedians of halves, or position \(\frac{k}{4}(n+1)\) and interpolateQuartiles
outliersfences \(Q_1 - 1.5\,\)IQR, \(Q_3 + 1.5\,\)IQRBoxplot
spread in original units\(s = \sqrt{\sum(x_i-\bar x)^2/(n-1)}\)Variance & SD
mean/SD after \(Y = aX + b\)\(a\bar x + b\), \(|a|\,s\)Scaling
which centre to reportskewed: median; symmetric: meanShape
mean vs median from a shapetail side = side the mean is onShape
which chartcategories: bar/pie; one number: histogram/boxplot; two: scatterWhich chart
number of bins\(k = 1 + 3.322\log_{10} n\), \(w = \text{range}/k\) rounded upHistogram
a pie slicevalue/total × 360°Pie
percent in a category\(f/n \times 100\)Frequency tables
median of grouped data\(L + \frac{N/2 - CF}{f}h\)Grouped median