# Lecture 22 – The Normal Distribution, The Central Limit Theorem¶

## DSC 10, Spring 2023¶

### Announcements¶

• Lab 6 is due on Saturday 5/27 at 11:59PM.
• Homework 6 – the final homework of the quarter – is due on Tuesday 5/30 at 11:59PM.
• The Final Project is due on Tuesday 6/6 at 11:59PM.
• The Grade Report has been updated – take a look on Gradescope.

### Agenda¶

• The normal distribution.
• The Central Limit Theorem.

## The normal distribution¶

### Recap: Standard units¶

SAT scores range from 0 to 1600. The distribution of SAT scores has a mean of 950 and a standard deviation of 300. Your friend tells you that their SAT score, in standard units, is 2.5. What do you conclude?

### Recap: The standard normal distribution¶

• The standard normal distribution can be thought of as a "continuous histogram."
• Like a histogram:
• The area between $a$ and $b$ is the proportion of values between $a$ and $b$.
• The total area underneath the normal curve is is 1.
• Key idea: The $x$-axis in a plot of the standard normal distribution is in standard units.
• For instance, the area between -1 and 1 is the proportion of values within 1 standard deviation of the mean.
• The standard normal distribution's cumulative density function (CDF) describes the proportion of values in the distribution less than or equal to $z$, for all values of $z$.
• In Python, we use the function scipy.stats.norm.cdf.

## Using the normal distribution¶

Last time, we looked at a data set of heights and weights of 5000 adult males.

Both variables are roughly normal. What benefit is there to knowing that the two distributions are roughly normal?

### Example: Proportion of heights between 65 and 70 inches¶

Let's suppose, as is often the case, that we don't have access to the entire distribution of heights, just the mean and SD.

Using just this information, we can estimate the proportion of heights between 65 and 70 inches:

1. Convert 65 to standard units.
2. Convert 70 to standard units.
3. Use stats.norm.cdf to find the area between (1) and (2).

### Checking the approximation¶

Since we have access to the entire set of heights, we can compute the true proportion of heights between 65 and 70 inches.

Pretty good for an approximation! 🤩

### Chebyshev's inequality and the normal distribution¶

• Last class, we looked at Chebyshev's inequality, which stated that the proportion of values within $z$ SDs of the mean is at least $1-\frac{1}{z^2}$.
• This works for any distribution, and is a lower bound.
• If we know that the distribution is normal, we can be even more specific!
Range All Distributions (via Chebyshev's inequality) Normal Distribution
mean $\pm \ 1$ SD $\geq 0\%$ $\approx 68\%$
mean $\pm \ 2$ SDs $\geq 75\%$ $\approx 95\%$
mean $\pm \ 3$ SDs $\geq 88.8\%$ $\approx 99.73\%$

### 68% of values are within 1 SD of the mean¶

Remember, the values on the $x$-axis for the standard normal curve are in standard units. So, the proportion of values within 1 SD of the mean is the area under the standard normal curve between -1 and 1.

This means that if a variable follows a normal distribution, approximately 68% of values will be within 1 SD of the mean.

### 95% of values are within 2 SDs of the mean¶

• If a variable follows a normal distribution, approximately 95% of values will be within 2 SDs of the mean.
• Consequently, 5% of values will be outside this range.
• Since the normal curve is symmetric,
• 2.5% of values will be more than 2 SDs above the mean, and
• 2.5% of values will be more than 2 SDs below the mean.

### Recap: Proportion of values within $z$ SDs of the mean¶

Range All Distributions (via Chebyshev's inequality) Normal Distribution
mean $\pm \ 1$ SD $\geq 0\%$ $\approx 68\%$
mean $\pm \ 2$ SDs $\geq 75\%$ $\approx 95\%$
mean $\pm \ 3$ SDs $\geq 88.8\%$ $\approx 99.73\%$

The percentages you see for normal distributions above are approximate, but are not lower bounds.

Important: They apply to all normal distributions, standardized or not. This is because all normal distributions are just stretched and shifted versions of the standard normal distribution.

### Inflection points¶

• Last class, we mentioned that the standard normal curve has inflection points at $z = \pm 1$.
• An inflection point is where a curve goes from "opening down" 🙁 to "opening up" 🙂.
• We know that the $x$-axis of the standard normal curve represents standard units, so the inflection points are at 1 standard deviation above and below the mean.
• This means that if a distribution is roughly normal, we can determine its standard deviation by finding the distance between each inflection point and the mean.

### Example: Inflection points¶

Remember: The distribution of heights is roughly normal, but it is not a standard normal distribution.

• The center appears to be around 69.
• The inflection points appear to be around 66 and 72.
• So, the standard deviation is roughly 72 - 69 = 3.

## The Central Limit Theorem¶

### Back to flight delays ✈️¶

The distribution of flight delays that we've been looking at is not roughly normal.

### Empirical distribution of a sample statistic¶

• Before we started discussing center, spread, and the normal distribution, our focus was on bootstrapping.
• We used bootstrapping to estimate the distribution of a sample statistic (e.g. sample mean or sample median), using just a single sample.
• We did this to construct confidence intervals for a population parameter.
• Important: For now, we'll suppose our parameter of interest is the population mean, so we're interested in estimating the distribution of the sample mean.
• What we're soon going to discover is a technique for finding the distribution of the sample mean and creating a confidence interval, without needing to bootstrap. Think of this as a shortcut to bootstrapping.

### Empirical distribution of the sample mean¶

Since we have access to the population of flight delays, let's remind ourselves what the distribution of the sample mean looks like by drawing samples repeatedly from the population.

• This is not bootstrapping.
• This is also not practical. If we had access to a population, we wouldn't need to understand the distribution of the sample mean – we'd be able to compute the population mean directly.

Notice that this distribution is roughly normal, even though the population distribution was not! This distribution is centered at the population mean.

### The Central Limit Theorem¶

The Central Limit Theorem (CLT) says that the probability distribution of the sum or mean of a large random sample drawn with replacement will be roughly normal, regardless of the distribution of the population from which the sample is drawn.

While the formulas we're about to introduce only work for sample means, it's important to remember that the statement above also holds true for sample sums.

### Characteristics of the distribution of the sample mean¶

• Shape: The CLT says that the distribution of the sample mean is roughly normal, no matter what the population looks like.
• Center: This distribution is centered at the population mean.
• Spread: What is the standard deviation of the distribution of the sample mean? How is it impacted by the sample size?

### Changing the sample size¶

The function sample_mean_delays takes in an integer sample_size, and:

1. Takes a sample of size sample_size directly from the population.
2. Computes the mean of the sample.
3. Repeats steps 1 and 2 above 2000 times, and returns an array of the resulting means.

Let's call sample_mean_delays on several values of sample_size.

Let's look at the resulting distributions.

What do you notice? 🤔

### Standard deviation of the distribution of the sample mean¶

• As we increase our sample size, the distribution of the sample mean gets narrower, and so its standard deviation decreases.
• Can we determine exactly how much it decreases by?