Chapter 3 · Uncertainty
Vienna University of Economics and Business (WU)
November 2026
Paper quiz on Chapter 2 (10 min)
Assignment 1 is running
Part A — Uncertainty (this deck)
3.1 Is the difference real?
3.2 Populations and samples
3.3 Sampling variation
3.4 The standard error
3.5 The central limit theorem
3.6 Confidence intervals
3.7 Shares and the margin of error
3.8 Uncertainty in R
Part B — Experiments I (next deck)
Comparing two groups: is the difference larger than sampling variation alone would produce?
Driving question: How sure can I be? Every number from a sample is an estimate — today we learn to say how good an estimate it is.
Would you roll it out? What would you want to know before deciding?
Same 3.2-hour difference — but now we see how many users, how dispersed they are, and that the means are pulled by outliers. Would you still roll it out? Could 3.2 hours be the luck of the draw?
Welch Two Sample t-test
data: hours by group
t = 2.1617, df = 386.96, p-value = 0.03125
alternative hypothesis: true difference in means between group Smart Mix and group Control is not equal to 0
95 percent confidence interval:
0.293571 6.196096
sample estimates:
mean in group Smart Mix mean in group Control
23.21980 19.97497
With another 400 users, would the difference be the same? Could Smart Mix do nothing at all? What do t, the p-value, and the “95 percent confidence interval” tell us?
Randomization makes the comparison fair (§1.6).
Statistical inference tells us whether it is precise enough to tell a real effect from the noise of sampling.
2,000 users per group instead of 200 — with exactly the same group means:
Welch Two Sample t-test
data: hours by group
t = 6.8057, df = 3960.5, p-value = 0.00000000001157
alternative hypothesis: true difference in means between group Smart Mix and group Control is not equal to 0
95 percent confidence interval:
2.310072 4.179595
sample estimates:
mean in group Smart Mix mean in group Control
23.21980 19.97497
Same difference of 3.2 hours — but t = 6.8 instead of 2.2, p = 0.00000000001 instead of 0.03, and the interval shrinks from [0.3; 6.2] to [2.3; 4.2]. More users → less uncertainty about the same difference.
The same 400 users, each pulled halfway toward their group mean — means unchanged, spread halved:
Welch Two Sample t-test
data: hours by group
t = 4.3234, df = 386.96, p-value = 0.00001957
alternative hypothesis: true difference in means between group Smart Mix and group Control is not equal to 0
95 percent confidence interval:
1.769202 4.720465
sample estimates:
mean in group Smart Mix mean in group Control
23.21980 19.97497
Same means, same n — but t = 4.3, p = 0.00002, interval [1.8; 4.7]. Less spread within the groups → less uncertainty about the same difference.
| Users per group | Spread (SD) | t | p | |
|---|---|---|---|---|
| Original test | 200 | 16 / 14 | 2.2 | 0.03 |
| Larger sample | 2,000 | 16 / 14 | 6.8 | < 0.001 |
| More similar users | 200 | 8 / 7 | 4.3 | < 0.001 |
The difference was 3.2 hours in all three cases. What changed is how sure we can be about it — and that depends on only two things: how many users, and how different they are from each other.
Today’s chapter shows where this comes from: the standard error, \sigma / \sqrt{n} — spread divided by the square root of the sample size (§3.4).
The A/B test stays with us. Its outcome is continuous → the uncertainty of a mean:
Then the same question for shares (converted / not, voted for / not):
One question throughout: if we had drawn a different sample, how different could our number have been — and how far could it be from the truth?
| Sample (statistic) | Population (parameter) | |
|---|---|---|
| Size | n | N |
| Mean | \bar{x} | \mu |
| Standard deviation | s | \sigma |
| Share | \hat{p} | p |
Parameters: what we want to know. Statistics: what we can compute.
| Probability sampling | Non-probability sampling | |
|---|---|---|
| Principle | Known chance of selection; random | Convenience or researcher’s judgment |
| Techniques | Simple random · stratified · cluster · systematic | Convenience · quota · judgmental · snowball |
| Uncertainty | Can be quantified | Cannot be quantified reliably |
Typical sources of selection bias: under-coverage (not in the sampling frame) · non-response (non-respondents differ) · voluntary response (only the strongly opinionated answer)
Your group project uses a convenience sample — fine for learning, but be honest about it. The good news: your experiment is still fair, because conditions are randomized within the sample (§1.6).
Random error (sampling variation)
Systematic error (bias)
Under-coverage, non-response, voluntary response → systematic error. In the A/B test, randomization rules out bias in the comparison — random error remains.
Monthly listening time of all 25,000 WU students — simulated, so we know the true values. In reality we never do: that is why we sample.
Sampling variation: each random sample of 100 students gives a slightly different mean. Not a mistake — the unavoidable price of looking at a part instead of the whole. The question is only: how large is it?
Course book, §3.3 — draw 1, then 100, then 1,000 samples and watch the means pile up.
https://wu-rds.github.io/MA2026/03-uncertainty.html#sec-unc-sampling
Before clicking “1,000 samples”: where will the sample means pile up — and how far from the true mean will the most extreme ones be?
The means of many samples:
We only ever have one sample — but these three properties tell us how much to trust it.
The width of the sampling distribution:
\sigma_{\bar{x}} = \frac{\sigma}{\sqrt{n}}
Our example: 10 / \sqrt{100} = 1.00 hours
Square-root law: four times the sample, half the standard error — diminishing returns. This is why polls survey ~1,000 people, not 10,000.
Larger samples → sample means cluster more tightly. More variable populations → sample means scatter more.
Course book, §3.4 — move the sliders for n and σ.
https://wu-rds.github.io/MA2026/03-uncertainty.html#sec-unc-se
Your sample of 100 students gives a standard error of 1 hour per month. Your boss wants half an hour. How many students do you need?
SD: how much individuals differ. A property of the data — does not shrink with more data.
SE: how much sample means would differ. The precision of the estimate — shrinks with \sqrt{n}.
We never know \sigma — so we use the sample standard deviation s:
SE_{\bar{x}} = \frac{s}{\sqrt{n}}
Our first sample: s = 10.44 → SE = 1.04 hours (true value: 1.00).
Which one to report? Describe how customers differ → SD. Describe how precisely you estimated the mean → SE or a confidence interval. Error bars in charts must say which one they show.
Marketing data are rarely normal: sales, visits, streams, revenue — most customers a little, a few a lot.
Central limit theorem: whatever the shape of the population, the means of samples become normally distributed as n grows — centered on \mu, with width \sigma / \sqrt{n}.
Course book, §3.5 — choose a population shape, increase n step by step.
https://wu-rds.github.io/MA2026/03-uncertainty.html#sec-unc-clt
Why it matters: we do not need normal data — we need a normal sampling distribution. “n ≥ 30” is a rule of thumb, not a law: for extremely skewed data (streams!) you need much more.
Point estimate: “the average listening time is 49.2 hours”
Interval estimate: “… between 47.2 and 51.3 hours”
Casting a net: we cannot see the true mean — but we can throw a net around our estimate that catches it most of the time.
\text{CI} = \text{estimate} \pm \underbrace{\text{critical value}}_{\text{how sure we want to be}} \times \underbrace{\text{standard error}}_{\text{how much the estimate wobbles}}
Net metaphor after Radziwill (2015), Statistics (The Easier Way) with R.
Our sample: 49.24 ± 1.96 × 1.04 = [47.19; 51.29] hours
True mean: 49.93 — inside. This time.
The confidence refers to the method: of all intervals constructed this way, ~95% contain the true mean.
Not quite right: “95% probability that μ is in this interval” — a specific interval either contains μ or not. Fine in practice: “we are 95% confident that …” — remembering that ~1 in 20 such intervals is wrong.
Course book, §3.6 — draw batches of 100 intervals; change n and the confidence level.
https://wu-rds.github.io/MA2026/03-uncertainty.html#sec-unc-ci
What happens to the width and to the number of misses when you (a) increase n, (b) switch from 95% to 99%?
| n | 10 | 30 | 100 | ∞ |
|---|---|---|---|---|
| t value (95%) | 2.26 | 2.05 | 1.98 | 1.96 |
Small samples: t-distribution — R does it automatically
“The poll was conducted Sept. 13–17 and surveyed 1,000 registered voters nationally. The margin of error is plus or minus 3.1 percentage points.”
— NBC News, September 2024
The same question for a share: more than 150 million people voted. How can 1,000 respondents tell us anything? Where does ± 3.1 come from — and why not survey 10,000?
Polls taken in the same week come to different results — each one is a different random sample. Most of them stay within ± 3 points of the truth. That is what the margin of error describes.
Kennedy et al. (2018), “An Evaluation of the 2016 Election Polls in the United States”, Public Opinion Quarterly, 82(1), 1–33.
Standard error of a share:
SE_{\hat{p}} = \sqrt{\frac{\hat{p}\,(1-\hat{p})}{n}}
Margin of error = 1.96 \times SE_{\hat{p}}, largest at \hat{p} = 50%:
1.96 \times \sqrt{\tfrac{0.5 \times 0.5}{1{,}000}} = \mathbf{0.031}
The margin of error of the lead is roughly twice as large: even the 5-point lead in this poll is not a safe lead.
Your group project (~120 respondents): a share of ~50% comes with ± 9 points. Think twice before interpreting a 5-point difference.
Live calculator: course book, §3.7
https://wu-rds.github.io/MA2026/03-uncertainty.html#sec-unc-proportions
# A tibble: 2 × 6
group n mean se lower upper
<fct> <int> <dbl> <dbl> <dbl> <dbl>
1 Smart Mix 200 23.2 1.15 21.0 25.5
2 Control 200 20.0 0.968 18.1 21.9
The bar chart from the start of the session — now with intervals. The two intervals overlap — no effect? Not necessarily: the decision depends on the uncertainty of the difference, which has its own standard error. The interval t.test() reported (0.29 to 6.20 hours) is exactly that → Experiments I.
Back to the poll: 1,000 voters, 49% Harris, 44% Trump
share lower upper
Harris 0.49 0.4590159 0.5209841
Trump 0.44 0.4092336 0.4707664
The same with prop.test():
Each share ± about 3 points — the “± 3.1” from the news report, now computed. prop.test() takes the number of “successes” and the sample size; its interval differs slightly from the hand calculation (it uses the Wilson score interval, more reliable for small samples and shares near 0 or 1). Sample size planning follows in Chapter 4.
Next: back to Smart Mix — +3.2 hours: larger than sampling variation alone would produce? The difference has its own standard error — the logic of today carries over one to one, and we read the complete t-test output.
Marketing Analytics — Nils Wlömert