Section 1 of 10

1 Before you start

Before you begin, take a few minutes to check what you already know and how confident you feel. You will see the same questions again at the end of the module — this helps both you and us measure what you have learned. Click an option for every question and confidence rating, then click Next to continue.

Pre-test

You compute the mean HbA1c of your 12 sampled patients to estimate the mean of all diabetic adults. Which pairing is correct?

Pre-test

In a study of adults with type 2 diabetes, which of these is a parameter?

Pre-test

Which statement about a sample statistic such as the sample mean is correct?

Pre-test

What does the sampling distribution of the mean describe?

Pre-test

The standard error of a mean is computed in R as

Pre-test

A blood-pressure measurement has a standard deviation of 10 mmHg. If you quadruple the sample size from 25 to 100 patients, what happens to the standard error of the mean?

Pre-test

A colleague collects a much larger sample and is surprised the standard deviation barely changed. What is the correct explanation?

Pre-test

Length of stay is strongly right-skewed. According to the Central Limit Theorem, what becomes approximately Normal as the sample size grows?

Pre-confidence

I can tell a population parameter from a sample statistic in a clinical question and explain why a single sample mean is only an estimate of the truth.

Not at all confident
Fully confident
Pre-confidence

I can compute a standard error by hand and in R with sd(x) / sqrt(length(x)), and explain why a bigger sample shrinks the SE but not the SD.

Not at all confident
Fully confident
Pre-confidence

I can describe the sampling distribution of the mean and demonstrate the Central Limit Theorem from a simulation I ran myself, distinguishing it from the raw data.

Not at all confident
Fully confident
Section 2 of 10

2 Introduction

You have spent the earlier modules describing the patients in front of you — their mean HbA1c, their spread, their skew. The harder, more useful question is what those numbers say about every patient like them. This part makes that leap: from the single sample you actually measured to the population you can never fully see, and it lays the groundwork every confidence interval and hypothesis test in the next parts will stand on.

This part of the module covers four foundations, each built on the one before:

  • Population and sample — the difference between a fixed, unknown parameter you want and the statistic you can compute, and why one estimates the other.
  • The sampling distribution — how a statistic would vary if you repeated the same study many times; the single idea underneath every interval you will ever build.
  • Standard error versus standard deviation — how much your estimate would wobble between repeats, computed with sd(x) / sqrt(length(x)), and why it is not the spread of the patients.
  • The Central Limit Theorem — watched live by simulation rather than proved with algebra: the sample mean turns bell-shaped as your sample grows, even from sharply skewed clinical data.

By the end of this part you will be able to tell a parameter from a statistic in a clinical question, describe what a sampling distribution is and where its centre and spread come from, compute a standard error by hand and in R, explain why a bigger sample shrinks the SE but not the SD, and demonstrate the Central Limit Theorem from a simulation you ran yourself.

Try every snippet in the R Scratchpad on the right. The dataset diabetes_clinic.csv is already loaded for the parameter-and-statistic examples, and the sampling and CLT simulations build their own data with rexp(), sample(), replicate(), and set.seed(), so you can run everything as you read.

Section 3 of 10

3 Population and sample, parameter and statistic

Start with the thing you almost never have: the whole population — every patient your question is about, such as every adult with type 2 diabetes in Singapore. What you do have is a sample: the handful of patients you actually measured, like the twelve in diabetes_clinic.csv.

A fixed number that describes the whole population is a parameter — for example, the true mean HbA1c of every diabetic adult. You can almost never observe it. A number you compute from your sample is a statistic — for example, the mean HbA1c of your twelve patients. You can always compute it.

A parameter (like μ, the true mean HbA1c of every diabetic adult) is a fixed but unobservable number describing the whole population, while a statistic (like x̄, the mean of your 12 sampled patients) is the observable number you compute from a sample to estimate it.
A parameter (like μ, the true mean HbA1c of every diabetic adult) is a fixed but unobservable number describing the whole population, while a statistic (like x̄, the mean of your 12 sampled patients) is the observable number you compute from a sample to estimate it.

The whole game of inference is this: use the statistic you can compute to estimate the parameter you cannot. The sample mean is your best single guess at the population mean. Run the line below to compute that statistic from the clinic data.

Try it out

Try this snippet in the R Scratchpad on the right.

Try this snippet
library(readr)
clinic <- read_csv("diabetes_clinic.csv")
mean(clinic$hba1c, na.rm = TRUE)
The number you can calculate from your sample (x-bar) is the best single stand-in for the population value you can never calculate directly (mu), and making that substitution is the whole move of inference.
The number you can calculate from your sample (x-bar) is the best single stand-in for the population value you can never calculate directly (mu), and making that substitution is the whole move of inference.

Notice na.rm = TRUE. The hba1c column has two missing values. Leave it out and mean() returns NA, not a number — a silent trap whenever a clinical column has gaps.

Keep the two worlds straight.

  • A parameter is a fixed, unknown truth about the population.
  • A statistic is a known number that changes with every sample you draw.

The novice trap is treating your one sample mean as the answer; it is only an estimate, and the rest of this lesson is about how good an estimate it is.

A population parameter such as the true mean μ is a fixed but unknown constant, whereas a sample statistic such as x̄ takes a different value in every sample, so any single sample mean is only an estimate of the truth rather than the truth itself.
A population parameter such as the true mean μ is a fixed but unknown constant, whereas a sample statistic such as x̄ takes a different value in every sample, so any single sample mean is only an estimate of the truth rather than the truth itself.
Section 4 of 10

4 The sampling distribution: imagining the study repeated

Your sample mean is one number, but it is not the only one you could have gotten. Draw a different twelve patients and you get a slightly different mean. The sampling distribution is the spread of a statistic across many imagined repeats of the very same study. It is the single idea underneath every confidence interval.

You never actually repeat a real study hundreds of times. But you can imagine it, and in R you can simulate it. Picture drawing a fresh sample, computing its mean, and writing that mean down — then doing it a thousand times. The thousand means have their own shape, centre, and spread.

Repeating the same study in your imagination yields many slightly different sample means, and their accumulated shape, centred on the true value with a spread that is the standard error, is the sampling distribution that every confidence interval is built on.
Repeating the same study in your imagination yields many slightly different sample means, and their accumulated shape, centred on the true value with a spread that is the standard error, is the sampling distribution that every confidence interval is built on.

Two facts about that shape drive everything ahead. Its centre sits at the true population mean, so the sample mean is unbiased. Its spread tells you how much one study's mean is likely to miss by — and that spread has a name, the standard error, which is the next section.

The sampling distribution of the sample mean is centred on the true population mean (so the sample mean is unbiased), and its spread, called the standard error, measures how far a single study's mean is likely to fall from that truth.
The sampling distribution of the sample mean is centred on the true population mean (so the sample mean is unbiased), and its spread, called the standard error, measures how far a single study's mean is likely to fall from that truth.
Section 5 of 10

5 Standard error versus standard deviation

The spread of that sampling distribution has a name. The standard error is the standard deviation of a statistic across repeated samples — in plain terms, how much your estimate would wobble if you ran the study again. It measures uncertainty in an estimate.

Do not confuse it with the standard deviation, which you met describing data: the SD measures how spread out the individual patients are. The SD is about people; the SE is about your estimate of their average.

Repeating a study makes each sample mean land in a slightly different place around the true value, and the standard error is just the width of that pile of means, far narrower than the spread of the individual patients (the SD).
Repeating a study makes each sample mean land in a slightly different place around the true value, and the standard error is just the width of that pile of means, far narrower than the spread of the individual patients (the SD).

For a mean, the two are linked by a short formula: the standard error equals the sample SD divided by the square root of the sample size. In R that is sd(x) / sqrt(length(x)), where length(x) is the number of values.

Try it out

Try this snippet in the R Scratchpad on the right.

Try this snippet
hba1c <- c(7.2, 8.1, 6.5, 9.4, 7.8, 6.9, 8.4, 7.1)
se <- sd(hba1c) / sqrt(length(hba1c))
se

The square root in the denominator is the key. Quadruple your sample size and the SE halves, because the square root of four is two. So a bigger sample gives you a more precise estimate.

But notice what does not change. A bigger sample shrinks the SE, yet it leaves the SD essentially alone — patients are as different from each other in a big study as in a small one. The classic mistake is reporting the SD when you mean the SE, or expecting more data to shrink the SD; more data sharpens your estimate, not the spread of people.

Growing the sample makes your estimate of the mean more precise (SE falls as the square root of n) but leaves the spread of individuals (SD) untouched, so reporting SD when you mean SE, or expecting more data to shrink the SD, is a mistake.
Growing the sample makes your estimate of the mean more precise (SE falls as the square root of n) but leaves the spread of individuals (SD) untouched, so reporting SD when you mean SE, or expecting more data to shrink the SD, is a mistake.

Plug numbers into the formula directly to feel it. If the SD is 10 and you have 100 patients, the SE is ten divided by the square root of a hundred — ten divided by ten.

Now, let’s try the worked example below and see precision grow with sample size.

Worked example · A bigger sample sharpens the estimate

Work through this example in three stages. You unlock each stage only after the tutor confirms the previous one. Each stage removes more of the scaffolding — by the end you are writing it yourself.

Problem: A measurement has an SD of 10. Compute the standard error of the mean for a sample of 25, then for a sample of 100, and watch it halve.

Stage 1 · Study the solved example
Fully solved solution
sd_x <- 10
sd_x / sqrt(25)
sd_x / sqrt(100)
Walk-through
  1. SE = SD / sqrt(n)
  2. at n = 25 the SE is 10 / 5 = 2
  3. quadrupling n to 100 halves the SE to 10 / 10 = 1
Section 6 of 10

6 The Central Limit Theorem

Now the payoff. The Central Limit Theorem says that as your sample size grows, the sampling distribution of the mean becomes Normal — bell-shaped — almost no matter how lopsided the raw data is. That is why the Normal curve from Module 4 powers confidence intervals for means even when individual patients are not Normal.

Averaging more values pulls the sample mean's distribution toward a Normal bell centred on the true mean, no matter how skewed the individual data are, which is what lets the Normal curve underwrite confidence intervals for means.
Averaging more values pulls the sample mean's distribution toward a Normal bell centred on the true mean, no matter how skewed the individual data are, which is what lets the Normal curve underwrite confidence intervals for means.

We will not prove it with algebra. We will watch it happen. Three tools build the simulation. sample() draws patients at random; replicate() repeats an action many times and collects the answers; set.seed() fixes the random number generator so your run matches the next person's exactly.

Section 6.1 of 10

6.1 Build a skewed clinical population

Hospital length of stay is famously right-skewed: most patients leave in a few days, a long tail stays for weeks. We simulate such a population with rexp, the exponential distribution, which is heavily skewed — the opposite of Normal.

Try it out

Try this snippet in the R Scratchpad on the right.

Try this snippet
library(ggplot2)
set.seed(2025)
los <- rexp(10000, rate = 1 / 5) # 10,000 individual stays: right-skewed
means <- replicate(10000, mean(rexp(30, rate = 1 / 5))) # mean of each 30-patient sample
d1 <- data.frame(v = los, panel = "1. Individual patients (skewed)")
d2 <- data.frame(v = means, panel = "2. Mean of 30 patients (Normal)")
d <- rbind(d1, d2)
ggplot(d, aes(v)) +
 geom_histogram(bins = 40, fill = "steelblue") +
 facet_wrap(~ panel, scales = "free") +
 labs(x = "Length of stay (days)", title = "The Central Limit Theorem in action")

That histogram is anything but a bell. Hold that picture: the raw data is skewed. Now watch what happens to the mean of a sample drawn from it.

Averaging a heavily skewed variable across samples of 30 yields a sampling distribution of the mean that is near-Normal and tightly clustered on the true population mean, which is why sample means stay trustworthy even when the raw data looks nothing like a bell.
Averaging a heavily skewed variable across samples of 30 yields a sampling distribution of the mean that is near-Normal and tightly clustered on the true population mean, which is why sample means stay trustworthy even when the raw data looks nothing like a bell.
Section 6.2 of 10

6.2 Watch the mean turn Normal

Here is the simulation in one block. Read it from the inside out: draw a sample of size n with sample(), take its mean, and let replicate() do that 2000 times. With n = 5 the means are still a little skewed; bump n to 50 and the histogram of means is a clean bell.

Try it out

Try this snippet in the R Scratchpad on the right.

Try this snippet
set.seed(2025)
los <- rexp(10000, rate = 1 / 5)
means_n50 <- replicate(2000, mean(sample(los, size = 5))) #try 5 and 50
ggplot(data.frame(means_n50), aes(means_n50)) +
  geom_histogram(bins = 40, fill = "darkorange") +
  labs(x = "Sample mean of length of stay", title = "Means go Normal (n = 50)")
Averaging many samples turns even sharply skewed data into a Normal, bell-shaped distribution, and larger samples make that bell tighter and cleaner.
Averaging many samples turns even sharply skewed data into a Normal, bell-shaped distribution, and larger samples make that bell tighter and cleaner.

This is the trap the CLT is most often misread into. The CLT does NOT make your raw data Normal. The length-of-stay values are still skewed and always will be. What becomes Normal is the distribution of the sample mean. Confusing the two is the single most common error in this whole topic.

The Central Limit Theorem leaves your raw data as skewed as it ever was; what turns Normal, and tightens as the sample grows, is the distribution of the sample mean.
The Central Limit Theorem leaves your raw data as skewed as it ever was; what turns Normal, and tightens as the sample grows, is the distribution of the sample mean.

One more habit the simulation teaches. Re-running a simulation without set.seed() gives different numbers every time, so nobody can reproduce your figure. Set the seed once at the top, and your result is fixed. This is reproducibility, the same principle behind Quarto reports.

Section 7 of 10

7 Check your understanding

You have reached the end of the module. Try the same questions again — your answers here, paired with your pre-test answers, are how we measure what the module taught you. Answer every question and confidence rating, then click Submit and see results to view your score.

Post-test

You compute the mean HbA1c of your 12 sampled patients to estimate the mean of all diabetic adults. Which pairing is correct?

Post-test

In a study of adults with type 2 diabetes, which of these is a parameter?

Post-test

Which statement about a sample statistic such as the sample mean is correct?

Post-test

What does the sampling distribution of the mean describe?

Post-test

The standard error of a mean is computed in R as

Post-test

A blood-pressure measurement has a standard deviation of 10 mmHg. If you quadruple the sample size from 25 to 100 patients, what happens to the standard error of the mean?

Post-test

A colleague collects a much larger sample and is surprised the standard deviation barely changed. What is the correct explanation?

Post-test

Length of stay is strongly right-skewed. According to the Central Limit Theorem, what becomes approximately Normal as the sample size grows?

Post-confidence

I can tell a population parameter from a sample statistic in a clinical question and explain why a single sample mean is only an estimate of the truth.

Not at all confident
Fully confident
Post-confidence

I can compute a standard error by hand and in R with sd(x) / sqrt(length(x)), and explain why a bigger sample shrinks the SE but not the SD.

Not at all confident
Fully confident
Post-confidence

I can describe the sampling distribution of the mean and demonstrate the Central Limit Theorem from a simulation I ran myself, distinguishing it from the raw data.

Not at all confident
Fully confident
Section 8 of 10

8 Your results

Here is how your post-test answers compare with your pre-test answers. The pre/post pairing is the most reliable way to see what this module actually taught you.

Your score

Submit the post-test to see your results.

Muddiest point

What is the one thing from this module that is still unclear to you?

Rate this module

Overall, how would you rate this module?

How likely are you to recommend this module to a peer? (0 = not at all, 10 = extremely likely)