Why averages go normal
Today let's understand why a sample average behaves so differently from the individual data points it is built from, and why that difference turns out to be one of the most useful facts in statistics.
Priya runs the front desk at a walk-in clinic. Every time a patient checks in, she notes the time, and when the doctor finally calls them in, she logs how many minutes they waited. Here is what one morning of 20 patients looked like.
Most patients wait only a few minutes. A handful wait much longer, one even past 28 minutes. That long right-hand tail is what statisticians call right skewed, and it is the shape you see in wait times, incomes, and the gaps between calls at a support desk.
Here is the claim this lesson is going to test rather than just tell you about. Average the wait times of a group of patients instead of looking at one patient at a time, and that average behaves completely differently from the chart above: it settles into a bell shape, a bump in the middle that falls away evenly on both sides. That result has a name, the central limit theorem, and this lesson tests it directly instead of asking you to take it on faith.
The population we start from
Priya's 20 patients are a small sample. To talk about the clinic's wait times overall, you need the full population they came from: every patient who could possibly walk in, not just the 20 she happened to see that morning.
Wait times like these are commonly modelled with the exponential distribution, the standard distribution for how long you wait until something happens at a steady average rate, like a bus arriving or a patient being called in. Its only setting is that rate, and for Priya's clinic it works out to a mean wait of 12 minutes and, for this particular distribution, a standard deviation that also comes out to 12 minutes.
Draw 2,000 wait times from this population in R, plot them, and check the mean and standard deviation against those two numbers.
rexp(2000, rate = 1/12) draws 2,000 random values from the exponential distribution, and the rate argument is set to 1 divided by 12 because the mean of this distribution always equals 1 divided by the rate. The histogram shows the same right skew as Priya's 20 patients: a tall bar near 0 minutes and a long, thinning tail stretching out to the right. And mean() and sd() both land close to 12, the mean and standard deviation the population was built to have.
rexp(n, rate = 1/12) is how this lesson draws n wait times from the clinic's population, every single time.