HomeLearning HubIB Maths AITopic 4: Statistics and probability
Topic 4

Statistics and probability

Mathematics: Applications and Interpretation · 36 hours SL / 52 hours HL

This is the largest topic in the course — 36 hours at SL, more than any other — and it is where AI differs most sharply from AA. Almost every calculation here is done with technology, so the marks are for choosing the right test and saying what the result means.

🎯What you need to be able to do

  • Distinguish population from sample, name the sampling techniques, and explain how a method introduces bias.
  • Identify outliers by the \( 1.5 \times \mathrm{IQR} \) rule and decide whether to keep them.
  • Present data as histograms, cumulative frequency graphs and box-and-whisker diagrams, and read values off them.
  • Calculate and interpret mean, median, mode, quartiles, range, IQR, variance and standard deviation.
  • Predict the effect on the mean and standard deviation of adding a constant or multiplying by one.
  • Interpret Pearson’s \(r\) and Spearman’s \(r_s\), and know when each is appropriate.
  • Fit a regression line and use it to predict — while knowing when not to.
  • Use the probability rules with Venn and tree diagrams, including conditional probability and independence.
  • Work with discrete random variables, expected value, and the binomial and normal distributions.
  • Carry out a \( \chi^{2} \) test for independence, a \( \chi^{2} \) goodness of fit test and a \(t\)-test, and state the conclusion properly.
  • AHL Design valid data collection, and distinguish reliability from validity.
  • AHL Perform non-linear regression and interpret \( R^{2} \) and the sum of square residuals.
  • AHL Use the central limit theorem, confidence intervals, the Poisson distribution and Type I/II errors.
  • AHL Build transition matrices and find the steady state of a Markov chain.

📚The mathematics

4.1 Sampling and data

A population is everyone you want a conclusion about; a sample is who you measured. Data is discrete if it counts and continuous if it measures. Know the five techniques — simple random, convenience, systematic, quota and stratified — and be able to describe each and say what could go wrong.

When a question asks you to comment on a method, name the mechanism by which the sample stops resembling the population, not just “it could be biased”. A convenience sample reaches only people who were easy to reach; a survey with a low response rate hears only from people who cared enough to reply; a systematic sample can lock onto a hidden periodic pattern.

An outlier is more than \( 1.5 \times \mathrm{IQR} \) beyond the nearer quartile. That is a definition, not a verdict: decide whether it is a genuine extreme value or a recording error, and say which and why.

4.2 & 4.3 Presenting and summarising

Cumulative frequency graphs give medians, quartiles and percentiles — read across from the right fraction of the total and down to the axis. Box-and-whisker diagrams compare two distributions: medians for centre, IQR or range for spread, whisker lengths for skew. Roughly symmetric box and whiskers suggest the data may be normally distributed.

For grouped data use mid-interval values to estimate the mean; it is an estimate because the individual values are gone. The modal class only means something for equal class intervals.

Compute variance and standard deviation with technology. What you must know is their behaviour: adding a constant \(k\) to every value raises the mean by \(k\) and leaves the standard deviation unchanged; multiplying every value by \(k\) multiplies both the mean and the standard deviation by \(k\), and the variance by \( k^{2} \).

4.4 & 4.10 Correlation

Pearson’s \(r\) measures linear association, between \( -1 \) and \( 1 \). Describe it in two words: strength and direction. A value near zero means no linear relationship — a perfect parabola has \( r \approx 0 \), which is why you look at the scatter diagram as well as the number.

Spearman’s rank correlation \( r_s \) is Pearson’s coefficient applied to the ranks rather than the values. It detects any monotonic relationship, not just a linear one, and it is far less sensitive to outliers because an extreme value only ever moves one place in the ranking. Use \(r\) when you are testing for linearity and \( r_s \) when the relationship may be curved but consistently increasing or decreasing, or when outliers are distorting \(r\). If values tie, average their ranks.

The regression line of \(y\) on \(x\) passes through the mean point \( (\bar{x},\bar{y}) \). The gradient and intercept both mean something in context, and interpreting them is regularly worth marks: the gradient is the change in \(y\) per unit change in \(x\), in the units of the problem.

Two warnings worth marks in their own right. Correlation does not imply causation — there may be a lurking variable driving both. And beware extrapolation: a prediction outside the range of the data assumes a pattern continues with no evidence that it does. When a question asks about the reliability of a prediction, one of these two is almost always the expected answer.

4.5 & 4.6 Probability

\( \mathrm{P}(A) = \dfrac{n(A)}{n(U)} \)
\( \mathrm{P}(A \cup B) = \mathrm{P}(A)+\mathrm{P}(B)-\mathrm{P}(A \cap B) \)
\( \mathrm{P}(A|B) = \dfrac{\mathrm{P}(A \cap B)}{\mathrm{P}(B)} \)

\( \mathrm{P}(A') = 1 - \mathrm{P}(A) \), and the complement is usually the fast route: “at least one” almost always means \( 1 - \mathrm{P}(\text{none}) \).

Events are mutually exclusive when \( \mathrm{P}(A \cap B) = 0 \) and independent when \( \mathrm{P}(A \cap B) = \mathrm{P}(A)\mathrm{P}(B) \). These are different ideas, and testing for independence means computing both sides and comparing them — show both numbers.

On tree diagrams, multiply along branches and add between paths, and check each set of branches sums to 1. Watch whether sampling is with or without replacement.

The expected number of occurrences is \( n \times \mathrm{P} \): if 300 components are made and each has probability 0.04 of being faulty, you expect 12 faulty ones.

4.7–4.9 Distributions

For a discrete random variable, the probabilities must sum to 1 — that is how an unknown in the table is found — and \( \mathrm{E}(X) = \sum x\,\mathrm{P}(X = x) \). In a game where \(X\) is the player’s gain, \( \mathrm{E}(X) = 0 \) means the game is fair; a casino ensures it is negative.

\( X \sim \mathrm{B}(n,p) \) requires a fixed number of independent trials, two outcomes, and a constant \(p\). Then \( \mathrm{E}(X) = np \) and \( \mathrm{Var}(X) = np(1-p) \). Distinguish \( \mathrm{P}(X = k) \) from \( \mathrm{P}(X \le k) \), and remember \( \mathrm{P}(X > 3) = 1 - \mathrm{P}(X \le 3) \) for a discrete variable.

\( X \sim \mathrm{N}(\mu, \sigma^{2}) \) is symmetric about \( \mu \), with roughly 68% within one standard deviation, 95% within two and 99.7% within three. Both directions are examinable: forwards (boundaries to probability) and inverse (probability to boundary). For inverse normal, check which tail you have been given — “the top 10%” needs 0.90 entered, not 0.10.

4.11 Hypothesis testing

This is the distinctive AI SL material and it follows a fixed structure. State \( \mathrm{H}_0 \) and \( \mathrm{H}_1 \), find the \(p\)-value with technology, compare it with the significance level, and write a conclusion in context.

\[ p < \text{significance level} \;\Longrightarrow\; \text{reject } \mathrm{H}_0 \]
  • \( \chi^{2} \) test for independence. Uses a contingency table. \( \mathrm{H}_0 \): the two variables are independent. Degrees of freedom \( = (\text{rows}-1)(\text{columns}-1) \). In examinations tables have at most 4 rows or columns, and expected frequencies will exceed 5.
  • \( \chi^{2} \) goodness of fit. Tests whether data follows a stated distribution. \( \mathrm{H}_0 \): the data fits that distribution. At SL the degrees of freedom are \( n - 1 \).
  • \(t\)-test. Compares the means of two populations. At SL samples are unpaired, the population variance is unknown and assumed equal, so use the pooled two-sample \(t\)-test. The underlying variable must be normally distributed. Choose one-tailed or two-tailed from the wording: “is there a difference” is two-tailed, “is A greater than B” is one-tailed.
“Accept \( \mathrm{H}_0 \)” is not a conclusion. You either reject \( \mathrm{H}_0 \) or you do not have sufficient evidence to reject it — failing to find evidence is not the same as proving there is no effect. And the conclusion must name the context: “there is insufficient evidence at the 5% level to conclude that choice of subject depends on gender” earns the mark; “do not reject \( \mathrm{H}_0 \)” on its own does not.

AHL 4.12 Designing data collection

Questionnaire design: questions should be unbiased rather than leading, structured with consistent answer choices, and precise. Choosing which variables to collect, and how to categorise numerical data into a \( \chi^{2} \) table, are examinable judgements — and categories must be chosen so expected frequencies exceed 5. When parameters are estimated from the data itself, the degrees of freedom fall accordingly.

Reliability is consistency: would you get the same result again? Test it by test–retest or parallel forms. Validity is whether you are measuring what you intended at all: content validity and criterion-related validity. A bathroom scale reading 3 kg heavy every time is perfectly reliable and completely invalid, which is the example worth remembering.

AHL 4.13 Non-linear regression

Beyond linear, you may be asked for quadratic, cubic, exponential, power or sine regression, all with technology. Two measures of fit:

  • \( SS_{res} \), the sum of the squared residuals — smaller is better, and the regression itself is chosen to minimise it.
  • \( R^{2} \), the coefficient of determination — the proportion of the variability in the response variable accounted for by the model. An \( R^{2} \) of 0.87 means 87% of the variation is explained by the model, which is the sentence an interpretation question wants. For a linear model \( R^{2} = r^{2} \).

But \( R^{2} \) alone is a poor way to choose between models: adding parameters always raises it, and a model can fit the data beautifully while being nonsense in context. Look at the residuals, the shape and the plausibility too.

AHL 4.14–4.16 Estimation and confidence intervals

For a linear transformation, \( \mathrm{E}(aX+b) = a\mathrm{E}(X)+b \) and \( \mathrm{Var}(aX+b) = a^{2}\mathrm{Var}(X) \) — the \(b\) shifts without spreading. The sample mean \( \bar{x} \) is an unbiased estimate of \( \mu \), and \( s_{n-1}^{2} \) is an unbiased estimate of \( \sigma^{2} \). Note the \( n-1 \): the ordinary \( s_n^{2} \) systematically underestimates the population variance.

A linear combination of independent normal variables is normal, and in particular \( \bar{X} \sim \mathrm{N}\!\left(\mu, \dfrac{\sigma^{2}}{n}\right) \). The central limit theorem says that for large \(n\) — taken as \( n > 30 \) in examinations — the distribution of the sample mean approaches normality regardless of the distribution the sample was drawn from. That is what makes inference possible on data that is not itself normal.

A confidence interval for a mean uses the normal distribution when \( \sigma \) is known and the \(t\)-distribution when it is not, at any sample size. Interpret it carefully: a 95% confidence interval is a procedure that captures the true mean 95% of the time. When comparing two groups, heavily overlapping intervals mean you cannot claim a difference.

AHL 4.17 & 4.18 Poisson and formal testing

The Poisson distribution \( X \sim \mathrm{Po}(m) \) counts events in a fixed interval when they occur independently at a uniform average rate. Its mean and variance are both \(m\), which is a useful diagnostic: if sample data has mean and variance close together, Poisson is plausible. Sums of independent Poisson variables are Poisson, so a rate per hour scales to a rate per day by scaling \(m\). Contexts: calls to a helpline, emergency admissions, flaws per metre of cable, typos per page.

You should be able to choose between normal, binomial and Poisson from a context. Binomial has a fixed number of trials; Poisson counts occurrences with no fixed maximum; normal is continuous.

Formal testing at HL extends to critical values and critical regions, tests for a population mean, tests for a proportion using the binomial, tests for a Poisson mean, and testing whether a population correlation coefficient is zero. And the two errors:

  • Type I — rejecting a true \( \mathrm{H}_0 \). A false positive. Its probability is the significance level.
  • Type II — failing to reject a false \( \mathrm{H}_0 \). A false negative.

Lowering the significance level reduces Type I errors and increases Type II errors. Which matters more is a contextual judgement: for a smoke alarm you accept false alarms to avoid missing a fire; for a criminal conviction you accept the reverse.

AHL 4.19 Markov chains

A transition matrix \( T \) has \( T_{ij} \) equal to the probability of moving from state \(j\) to state \(i\), so its columns sum to 1. After \(n\) steps the state is

\[ \mathbf{s}_n = T^{n}\mathbf{s}_0 \]

For a regular chain the state settles to a steady state independent of where it started. Find it either by raising \(T\) to a high power and reading off the columns, or exactly by solving \( T\mathbf{s} = \mathbf{s} \) together with the condition that the entries sum to 1 — and examination questions will say when an exact solution is required. Notice what that equation means: the steady state is the eigenvector of \(T\) with eigenvalue 1, which is why Topic 1 teaches eigenvectors.

✏️Worked example

A school surveys 200 students on whether they walk, cycle or take the bus to school, and records their year group. The results are:

Year 11: walk 34, cycle 28, bus 38.   Year 12: walk 26, cycle 20, bus 54.

(a) State the null and alternative hypotheses for a \( \chi^{2} \) test for independence. (b) State the number of degrees of freedom. (c) The test gives \( \chi^{2}_{calc} = 6.83 \) and a \(p\)-value of 0.0329. Using a 5% significance level, state and interpret the conclusion. (d) Explain what would change if a 1% significance level had been used.

(a) \( \mathrm{H}_0 \): method of travel to school is independent of year group. \( \mathrm{H}_1 \): method of travel to school is not independent of year group. Both must be phrased in context — “the variables are independent” is too vague to earn the mark.

(b) The table is 2 rows by 3 columns, so

\[ \nu = (2-1)(3-1) = 2 \]

(c) Compare \( p = 0.0329 \) with the significance level \( 0.05 \). Since \( 0.0329 < 0.05 \), reject \( \mathrm{H}_0 \). In context: there is sufficient evidence at the 5% significance level to conclude that method of travel to school depends on year group. Looking at the data, the difference is driven mainly by bus use, which is markedly higher in Year 12.

(d) At the 1% level the comparison becomes \( 0.0329 > 0.01 \), so you would not reject \( \mathrm{H}_0 \). The same data and the same statistic now give the opposite decision, because a 1% level demands stronger evidence before accepting a claim. The result is therefore significant at 5% but not at 1% — which is a genuinely informative thing to say about it.

Check it. Degrees of freedom should always be a small positive integer; if you compute \( \nu = 6 \) here you have used \( \text{rows} \times \text{columns} \) instead of subtracting one from each. And a \( p \)-value must lie between 0 and 1 — anything else means the wrong quantity has been read off the calculator screen.
Do not confuse the two comparisons. With the \(p\)-value you reject when \( p < \) the significance level; with the critical value you reject when \( \chi^{2}_{calc} > \) the critical value. The inequality points the opposite way. Students who half-remember both rules and compare \( \chi^{2}_{calc} = 6.83 \) against \( 0.05 \) reject everything they ever test.

📝Practise

Work through these, then reveal the answer. Each question targets a different objective from the list above.

1. The times (minutes) taken by 9 students to complete a puzzle are 12, 15, 15, 18, 20, 22, 25, 27, 48. Find the median and quartiles, and determine whether 48 is an outlier.
Ordered already, \( n = 9 \). Median is the 5th value, 20. Lower quartile is the median of the first four, \( \dfrac{15+15}{2} = 15 \); upper quartile is the median of the last four, \( \dfrac{25+27}{2} = 26 \). So \( \mathrm{IQR} = 11 \) and \( 1.5 \times \mathrm{IQR} = 16.5 \). The upper boundary is \( 26 + 16.5 = 42.5 \). Since \( 48 > 42.5 \), it is an outlier. Whether to remove it depends on context: if the student was interrupted, discard it; if they genuinely found it hard, it is real data.
2. Eight countries are ranked by GDP per capita and by average life expectancy. Explain why Spearman's \( r_s \) might be preferred to Pearson's \( r \) here.
The relationship between GDP per capita and life expectancy is strongly monotonic but not linear — life expectancy rises steeply at low incomes and then flattens off, so a straight line fits badly and Pearson's \(r\) understates the association. Spearman's coefficient works on ranks, so it detects any consistently increasing relationship regardless of shape. It is also far less affected by one very rich outlier country, which would drag a Pearson calculation around considerably.
3. In a factory, 6% of items are defective. A sample of 25 is taken. Find the probability that (a) exactly 2 are defective, (b) more than 3 are defective, (c) the expected number of defectives.
\( X \sim \mathrm{B}(25, 0.06) \). (a) \( \mathrm{P}(X = 2) = 0.2534 \). (b) \( \mathrm{P}(X > 3) = 1 - \mathrm{P}(X \le 3) = 1 - 0.9538 = 0.0462 \) — note "more than 3" excludes 3, so the complement is \( \mathrm{P}(X \le 3) \), not \( \mathrm{P}(X \le 2) \). (c) \( \mathrm{E}(X) = np = 25 \times 0.06 = 1.5 \) defectives. An expected value need not be a whole number.
4. Two groups of students sit the same test. Group A (\(n = 20\)) has mean 64.2 and Group B (\(n = 22\)) has mean 69.8. A two-tailed \(t\)-test gives \( p = 0.041 \). State the hypotheses and the conclusion at the 5% level, and state one assumption required.
\( \mathrm{H}_0 \): \( \mu_A = \mu_B \) — the mean scores of the two groups are equal. \( \mathrm{H}_1 \): \( \mu_A \ne \mu_B \) — the mean scores differ (two-tailed, because the question asks about a difference rather than a direction). Since \( p = 0.041 < 0.05 \), reject \( \mathrm{H}_0 \): there is sufficient evidence at the 5% level to conclude that the mean test scores of the two groups differ. Required assumption: the test scores are normally distributed in each population (and at SL, that the two variances are equal, so the pooled test applies).
5. AHL A call centre receives calls at an average rate of 4.5 per 10-minute interval. Find the probability of (a) exactly 6 calls in 10 minutes, (b) fewer than 3 calls in 5 minutes.
(a) \( X \sim \mathrm{Po}(4.5) \), so \( \mathrm{P}(X = 6) = 0.1281 \). (b) Halving the interval halves the mean: \( Y \sim \mathrm{Po}(2.25) \). "Fewer than 3" means \( \mathrm{P}(Y \le 2) = 0.6093 \). Scaling the mean with the interval is the step people miss — the rate is per unit time, so it must be recomputed whenever the window changes.
6. AHL Commuters choose train or car. Each week, 85% of train users stay with the train and 10% of car users switch to the train. Write the transition matrix and find the long-term proportion using the train.
With states (train, car), \( T = \begin{pmatrix} 0.85 & 0.10 \\ 0.15 & 0.90 \end{pmatrix} \) — columns sum to 1, as they must. For the steady state \( \mathbf{s} = \begin{pmatrix} t \\ c \end{pmatrix} \), solve \( T\mathbf{s} = \mathbf{s} \): the first row gives \( 0.85t + 0.10c = t \), so \( 0.10c = 0.15t \) and \( c = 1.5t \). With \( t + c = 1 \): \( t + 1.5t = 1 \), so \( t = 0.4 \). In the long run 40% use the train and 60% the car, whatever the starting split. Confirm by computing \( T^{50} \) — every column converges to \( \begin{pmatrix} 0.4 \\ 0.6 \end{pmatrix} \).

🔗Go deeper — other people’s work

These are external resources, not mine. If one stops working, tell me and everything above it on this page still stands.

  • Seeing Theory (Brown University) — visual, interactive probability, distributions and inference
  • Setosa — an animated explanation of Markov chains
  • Spurious Correlations — a whole site of strong \(r\) values with no causation whatsoever