,Descriptive Statistics.......................................................................................................................................................... 4
D1 · Describing a qualitative variable ......................................................................................................................... 4
D2.1 · Distribution of a quantitative variable — needle graph & histogram............................................................. 7
D2.2 · Summary measures — mean, variance, standard deviation, and more ....................................................... 10
D2.3 · Cumulative distribution, percentiles, and the boxplot .................................................................................. 13
D2.4 · Transformations .............................................................................................................................................. 16
D2.5 · Working from binned data only ..................................................................................................................... 18
D3.0 · Relationships between variables — the big picture ...................................................................................... 20
D3.1 · Two qualitative variables ................................................................................................................................ 22
D3.2 · A quantitative variable across groups ............................................................................................................ 24
D3.3 · Two quantitative variables — scatterplot & correlation ............................................................................... 25
D3.4 · Linear combinations of two variables ............................................................................................................ 28
Formula Reference Sheet ................................................................................................................................................ 30
Probability ........................................................................................................................................................................ 31
P1.0 · Motivation — why bother with probability at all .......................................................................................... 31
P1.1 · Definition of probability .................................................................................................................................. 31
P1.2 · Counting rules .................................................................................................................................................. 33
P1.3 · Rules of probability (the axioms) .................................................................................................................... 36
P1.4 · Conditional probability, independence, and the general multiplication rule ............................................... 38
Discrete Random Variables ............................................................................................................................................. 40
P2.1 · Probability distributions.................................................................................................................................. 40
P2.2 · Cumulative distribution and percentiles (discrete) ........................................................................................ 42
P2.3 · Mean and standard deviation (discrete) ........................................................................................................ 43
P2.4 · The Binomial distribution ................................................................................................................................ 44
Continuous Random Variables ........................................................................................................................................ 47
P3.1 · Density and probabilities ................................................................................................................................ 47
P3.2 · Cumulative distribution and percentiles (continuous)................................................................................... 49
P3.3 · Mean and standard deviation (continuous) ................................................................................................... 50
P3.4a · The Normal distribution ................................................................................................................................ 51
P3.4b · Normal approximation to the Binomial ....................................................................................................... 53
P3.5 · Standardizing and evaluating the normal model ........................................................................................... 56
Combining Random Variables ......................................................................................................................................... 59
P4.1 · Summary measures for a linear transformation ............................................................................................ 59
P4.2 · Summary measures for a linear combination ................................................................................................ 60
P4.3 · Sums and averages .......................................................................................................................................... 61
P4.4 · The Central Limit Theorem .............................................................................................................................. 64
Formula Reference Sheet ................................................................................................................................................ 66
Rania El Ghalbzouri 2
,Inference .......................................................................................................................................................................... 68
I0 · The question Part I exists to answer ................................................................................................................... 68
I1 · Point estimators .................................................................................................................................................. 69
I2 · Confidence interval for μ ..................................................................................................................................... 75
I3.1 · Hypothesis testing ............................................................................................................................................ 83
I3.2 · Hypothesis testing linked to confidence intervals .......................................................................................... 92
I3.3 · Critical values and power ................................................................................................................................. 95
Formula Reference Sheet .............................................................................................................................................. 101
Hypothesis Tests ............................................................................................................................................................ 104
H0.1 · The recipe — how to read (and write) every test in this part ..................................................................... 104
H0.2 · A motivating example — the Leuven apartment ......................................................................................... 106
H1.1 · Test for one mean (σ unknown) ................................................................................................................... 106
H1.2 · Tests for normality ........................................................................................................................................ 111
H2.1 · Paired versus unpaired data ......................................................................................................................... 116
H2.2 · Test about two paired means ....................................................................................................................... 120
H2.3 · Test about two unpaired means................................................................................................................... 125
H3.1 · Comparing more than two means — the ANOVA F-test ............................................................................. 132
H3.2 · Post-hoc tests ................................................................................................................................................ 139
H4.1 · Test about the Pearson correlation .............................................................................................................. 144
H4.2 · Chi-square test for independence ................................................................................................................ 149
H5.1 · Chi-square test for goodness of fit ............................................................................................................... 155
Formula Reference Sheet .............................................................................................................................................. 162
Simple Regression .......................................................................................................................................................... 167
SR0 · The one example that runs through the whole part ..................................................................................... 167
SRA1 · Model specification of a simple linear regression model ............................................................................. 169
SRA2 · Assumptions of the simple linear regression model .................................................................................... 174
SRA3 · Non-linear models ......................................................................................................................................... 178
SRC1 · Measuring goodness of fit — decomposition of variance and R-square ..................................................... 188
SRC2 · The ANOVA F-test for the regression ............................................................................................................ 193
SRD · Checking the assumptions .............................................................................................................................. 197
Formula Reference Sheet .............................................................................................................................................. 208
Rania El Ghalbzouri 3
, PART D Descriptive Statistics
D1 · Describing a qualitative variable
A qualitative (categorical) variable has outcomes, not numbers — gender, party voted for, hair colour.
Everything you can do with it comes down to one question: how often does each outcome occur?
Frequency table
State every possible outcome m1, m2, …, mk, then count, for a sample, how often each one occurs.
𝑛𝑖
ni = absolute frequency of outcome mi p̂ i = 𝑛
= sample proportion (relative frequency)
EVERY SYMBOL
n — the total sample size (n1 + n2 + … + nk = n) p̂ i — the fraction of the sample with outcome mi; all p̂ i
sum to 1
mode — the outcome with the largest frequency
Worked example (ESS survey, n = 1704). Gender split into a 2-row frequency table:
Gender Count Proportion
Male 820 48.1%
Female 884 51.9%
Total 1704 100%
Cumulative frequencies — ordinal data only
If the outcomes have a natural order (like hours of TV watched), you can also accumulate: F̂i = p̂ 1 + p̂ 2 + … +
p̂ i, the proportion of the sample at or below outcome i.
▲ WATCH OUT
Cumulative frequencies only make sense for ordinal (ordered) or numeric outcomes. "Cumulative percentage of
hair colour" is meaningless — there is no natural first, second, third category to accumulate through.
Worked example continued (same ESS survey). Hours of TV watched on an average weekday, 8 ordered
categories — here the running total actually means something: "79.93% of respondents watch 3 hours or
less."
Hours of TV / weekday Count Proportion Cumulative proportion
None 47 2.76% 2.76%
< 0.5 84 4.93% 7.69%
1 238 13.97% 21.65%
1.5 281 16.49% 38.15%
2 265 15.55% 53.70%
Rania El Ghalbzouri 4
, Hours of TV / weekday Count Proportion Cumulative proportion
2.5 254 14.91% 68.60%
3 193 11.33% 79.93%
>3 342 20.07% 100%
Total 1704 100% —
SPSS note — Valid Percent vs Percent
SPSS's Frequencies output always prints two percentage columns, and they answer different questions.
Percent is out of every respondent, including missing values (no answer, don't know, refusal). Valid Percent
is out of only the respondents who actually answered — it's almost always the one you want to report.
Count Percent
Valid answers 1254 73.6%
Missing (not applicable / refusal / don't know) 450 26.4%
Total 1704 100%
○ PROFESSOR NOTE
SPSS output for "party voted for" (ESS survey): the mode is N-VA, with 279 of the 1254 valid answers (Valid Percent
22.2%). The professor's own annotated slide circles the Missing category and draws a red X straight through the
Cumulative Percent column — because party is nominal, accumulating percentages is meaningless here, exactly
the trap from the watch-out box above.
Graphing a qualitative variable
Chart Best for Rule of thumb
Pie / doughnut
showing parts of a whole harder to compare near-equal slices than a bar chart
chart
Needle graph (bar comparing frequencies across nominal: order bars by decreasing frequency; ordinal:
plot) categories keep the natural order
one categorical variable,
100% stacked bar ordinal only; can overlay the cumulative proportions
cumulative view
Rania El Ghalbzouri 5
, Figure D1.1. Both bars show the exact same data (820 vs 884). Truncating the y-axis (left) manufactures a
visual difference that isn't really there — this is the professor's own Excel-default warning. Always check
where a bar chart's axis starts before you trust the impression it gives.
○ PROFESSOR NOTE
"Graphs might be misleading" — said explicitly on the slides. Two concrete traps: (1) a y-axis that doesn't start at
0 (Excel's default for a plain bar chart), and (2) leaving a nominal variable's bars in whatever order the software
happens to list them, instead of sorting by decreasing frequency so the mode jumps out visually.
✎ TRY IT YOURSELF
A researcher asks 200 people their preferred commute mode: Car (86), Bike (34), Train (52), Walk (28).
1. Build a frequency table with counts and proportions.
2. Is this variable nominal or ordinal? Does a cumulative frequency make sense here?
3. Which chart type would you pick, and in what order would you place the bars?
Rania El Ghalbzouri 6
,D2.1 · Distribution of a quantitative variable — needle graph & histogram
For a quantitative variable, the same question applies — how often does each outcome occur — but now
outcomes are numbers, and usually too many distinct ones to list one by one.
Few distinct outcomes → needle graph
If a discrete variable only takes a handful of values (e.g. household size 1–8), a needle graph still works exactly
like D1's bar plot.
Figure D2.1a. A needle graph always leaves a visible gap between bars — that gap is what tells the reader
the outcomes are discrete, separate values, not a continuous range. Removing the gap (right) makes it look
like a histogram of continuous data, which is misleading for a genuinely discrete variable.
Many outcomes or continuous data → bin, then histogram
Once there are too many distinct values (or the variable is continuous), grouping into bins is unavoidable. A
histogram is then just a bar plot of the binned frequency table, drawn without gaps — the missing gap now
correctly signals a continuous scale.
✓ MEMORY TRICK
Gap between bars = discrete outcomes (needle graph). No gap = continuous scale (histogram). The presence or
absence of the gap is itself part of the message.
Choosing bins — rules of thumb
● Number of bins: aim for 5–20; a common starting point is √n, or Sturges' rule, log2(n) + 1
● Bin width ≈ range / number of bins
● Start the first bin a little below the minimum
● Avoid one bin swallowing almost all the data — that defeats the point
○ PROFESSOR NOTE
The choice of bins is genuinely subjective — different reasonable choices give visibly different histograms of the
same data. That is a feature of the technique to be aware of, not a bug to solve.
Rania El Ghalbzouri 7
,Counts, proportion, or density — the y-axis has three modes
Once outcomes are grouped into bins with width w, the y-axis of a histogram can show any of three things:
hi = p̂ i / bin width (density height)
EVERY SYMBOL
ni — count of observations in bin i p̂ i — proportion of observations in bin i (ni/n)
hi — density height of bin i: makes the bar's area (not height) equal p̂ i
Figure D2.1b. Same apartments data (45 observations, area in m 2), three y-axis choices. Counts and
proportion look identical in shape — only the axis scale differs. The density version is what you need whenever
bins are not all the same width (see next).
▲ WATCH OUT
A density histogram's total area always equals 1 — that is precisely what makes 'proportion' and 'area of the bar'
the same thing.
Why density matters: unequal bin widths
With equal-width bins, counts and density histograms have the exact same shape. The moment bins have
different widths, a counts-based histogram becomes actively misleading — a wide bin looks tall simply
because it covers more ground, not because it's more common.
Figure D2.1c. Same household-income data, unequal bins. The counts version (left) makes the [1000,1500]
bin look almost as important as [0,1000], purely because of how the bins happen to be drawn. The density
version (right) correctly shows that most households sit in the two narrowest, cheapest bins.
Rania El Ghalbzouri 8
,Reading the shape
Once you can draw a histogram, the real skill is reading it: modality, symmetry, and outliers.
Figure D2.1d. The vocabulary you'll use for the rest of the course to describe any distribution: how many peaks
(modes), whether it's symmetric or skewed (and to which side the long tail points), and whether outliers are
visible.
○ PROFESSOR NOTE
"Skewed to the right" means the long tail points right (toward large values) — most real income and price data
looks like this. Don't confuse the direction of the tail with where most of the data sits: with a long right tail, most
observations are actually bunched on the left.
▲ WATCH OUT
Do not label observations as outliers too soon. A long tail is not automatically an error — investigate before
deciding a point doesn't belong.
Rania El Ghalbzouri 9
, ✎ TRY IT YOURSELF
A histogram of 90 exam scores (0–100) uses bins [0,50], ]50,70], ]70,85], ]85,100] with counts 6, 24, 42, 18.
1. Are these bins equal width? What does that mean for interpreting a counts-based version of this
histogram?
2. Compute the density height for the bin ]70,85].
3. Sketch (in words) what the shape would look like: symmetric, or skewed — and in which direction?
D2.2 · Summary measures — mean, variance, standard deviation, and more
A histogram shows the whole distribution; a summary measure boils it down to one or two numbers. You
almost always need both a centre measure and a spread measure — a centre alone can seriously mislead
you.
○ PROFESSOR NOTE
"A statistician who could not swim went very confidently into a river that was on average 1 metre deep. He
drowned." (G. Bomans, quoted on the slides.) The average told him nothing about how deep the deepest part
was — that's what a spread measure is for.
Rania El Ghalbzouri 10