Normal Distribution

Mine Doğucu

Normal distribution

A familiar shape

Three histograms side by side. Left: heights of 260 physically active women, centered near 165 cm. Middle: heights of 247 physically active men, centered near 178 cm. Right: heights of 435 NBA players, centered near 201 cm. All three are roughly symmetric and bell shaped.

Many variables have a symmetric, bell-shaped distribution.

Data: bdims and nba_heights in the openintro package.

Normal distribution

The normal distribution is a symmetric, bell-shaped curve. It is completely described by two numbers:

  • its mean: where the center is,
  • its variance, or standard deviation (the square root of the variance): how spread out it is.

Histogram of the heights of active women with a smooth green normal curve on top. The curve, with mean 165 cm and standard deviation 6.5 cm, follows the shape of the histogram closely.

Heights of active women are approximately normal with mean 165 cm and standard deviation 6.5 cm.

Changing the mean

Three normal curves with the same standard deviation, 6.5, centered at 150, 165, and 180. Changing the mean slides the curve left or right without changing its shape.

The mean moves the curve left and right.

Changing the standard deviation

Three normal curves all centered at 165 with standard deviations 4, 6.5, and 12. The curve with standard deviation 4 is tall and narrow; the one with 12 is short and wide.

The standard deviation makes the curve narrower or wider. The total area under the curve is always 1, so a narrower curve is taller.

SAT scores

From here on, we will use SAT scores as our example.

We will assume that total SAT scores have

  • mean 1000
  • standard deviation 200

and SAT Math scores have mean 500 and standard deviation 100.

These values are close to, but not the same as, recent SAT scores: we altered them to make mental math easier.

Notation

\[\text{random variable} \sim N(\text{mean}, \text{variance})\]

Example

Let \(X\) be the total SAT score of a randomly selected test taker.

\[X \sim N(1000, 200^2)\]

is read “\(X\) is normally distributed with mean 1000 and variance \(200^2\).” The standard deviation is 200 and the variance is \(200^2 = 40{,}000\).

Many ways to say the same thing

All of these mean the same thing:

  • \(X\) is normally distributed with mean 1000 and variance 40,000.
  • \(X\) is normally distributed with mean 1000 and standard deviation 200.
  • \(X \sim N(1000, 40{,}000)\)
  • \(X \sim N(1000, 200^2)\)
  • \(X \sim \text{Normal}(\text{mean} = 1000, \text{sd} = 200)\)

Careful!

Note

Some books and some software put the standard deviation (not the variance) as the second number. In R, pnorm(), qnorm(), and rnorm() all use the standard deviation:

pnorm(1200, mean = 1000, sd = 200)

Always check whether the second number is the standard deviation or the variance. Writing it as \(200^2\) makes it clear.

Reading the notation

Exercise

For each normal distribution, find the mean, the variance, and the standard deviation.

  1. \(Y \sim N(10, 4)\)
  2. \(Z \sim N(0, 1)\)
  3. \(W \sim N(-3, 3^2)\)
  4. SAT Math scores have mean 500 and standard deviation 100.

Note: \(N(0, 1)\) in (b) is called the standard normal distribution.

Not just for \(X\)

The random variable on the left of \(\sim\) can be many things.

What can be normally distributed: an observation or a population parameter
Notation What is normally distributed?
\(X \sim N(1000, 200^2)\) a random observation (in the population, and so also in a sample): the SAT score of one test taker
\(\mu \sim N(7, 0.5^2)\) a random population parameter: our belief about the mean hours of sleep of all Harvard students

In a few weeks, we will see that a random sample statistic, like \(\bar{X}\), can also be normally distributed.

This is why we say “mean” and “variance” for the two numbers in \(N(\ , \ )\) rather than giving them their own symbols: sometimes the random variable itself is a mean, like \(\mu\)!

Probability as area

Area = probability

The total area under a normal curve is 1. The probability that the random variable falls in an interval is the area under the curve over that interval.

Three normal curves for SAT scores, centered at 1000 with standard deviation 200. In the first, the area to the left of 800 is shaded, labeled P(X < 800). In the second, the area to the right of 1400 is shaded, labeled P(X > 1400). In the third, the area between 800 and 1400 is shaded, labeled P(800 < X < 1400).

We will never calculate these areas by hand. We will use functions.

The plot_normal() function

plot_normal(random_variable = "x",  # "x", "x_bar", "p", "mu", or "pi"
            mean = 1000,            # mean of the normal distribution
            sd = 200,               # standard deviation (or variance = 40000)
            lower = 800,            # shade from here...
            upper = 1400)           # ...to here
  • It draws the normal curve with the random variable on the x-axis.
  • It shades the area between lower and upper and writes the area under the plot.
  • Leave out lower to shade everything below upper, and leave out upper to shade everything above lower.

The calc_prob_normal() function

plot_normal() draws the picture. To get the probability as a number that you can use in your answers, use calc_prob_normal() with the same arguments:

calc_prob_normal("x", mean = 1000, sd = 200, lower = 800, upper = 1400)
[1] 0.8185946

You can save it and use it with inline code:

prob_800_1400 <- calc_prob_normal("x", mean = 1000, sd = 200, lower = 800, upper = 1400)

About 82% of test takers scored between 800 and 1400.

Area to the left

What is the probability that a randomly selected test taker scored below 800?

plot_normal("x", mean = 1000, sd = 200, upper = 800)
calc_prob_normal("x", mean = 1000, sd = 200, upper = 800)
[1] 0.1586553
Normal curve for X with mean 1000 and standard deviation 200. The area to the left of 800 is shaded pink, and a yellow label below the curve reads Area = 0.1587. The title is P(X < 800).

Area to the right

What is the probability that a randomly selected test taker scored above 1400?

plot_normal("x", mean = 1000, sd = 200, lower = 1400)
calc_prob_normal("x", mean = 1000, sd = 200, lower = 1400)
[1] 0.02275013
Normal curve for X with mean 1000 and standard deviation 200. The area to the right of 1400 is shaded pink, and the label reads Area = 0.0228.

Area in between

What is the probability that a randomly selected test taker scored between 800 and 1400?

plot_normal("x", mean = 1000, sd = 200, lower = 800, upper = 1400)
Normal curve for X with mean 1000 and standard deviation 200. The area between 800 and 1400 is shaded pink, and the label reads Area = 0.8186.

The 68-95-99.7 rule

Three standard normal curves. The first shades the area within 1 standard deviation of the mean, labeled 68%. The second shades within 2 standard deviations, labeled 95%. The third shades within 3 standard deviations, labeled 99.7%. The x-axes are labeled mean minus 3 sd through mean plus 3 sd.

For any normal distribution, about 68% of the values are within 1 standard deviation of the mean, 95% within 2, and 99.7% within 3.

The 68-95-99.7 rule

Exercise

SAT total scores are approximately \(N(1000, 200^2)\). Without using R, find the approximate probability that a randomly selected test taker scored

  1. between 800 and 1200.
  2. between 600 and 1400.
  3. above 1400.
  4. above 1000.

Then check (a) and (c) with calc_prob_normal().

Match the picture

Four normal curves labeled A, B, C, D, each centered at 1000 with standard deviation 200 and x-axis ticks at 800, 1000, and 1400. A shades the region to the right of 800. B shades the region to the left of 800. C shades the region between 800 and 1400. D shades the region to the right of 1400.

Exercise

\(X \sim N(1000, 200^2)\). Match each picture to a probability.

  1. \(P(X < 800)\)
  2. \(P(X > 1400)\)
  3. \(P(X > 800)\)
  4. \(P(800 < X < 1400)\)

Then write the plot_normal() code for each.

Exactly 1200?

Discussion

\(X \sim N(1000, 200^2)\). According to this model, what is the probability that a randomly selected test taker scored exactly 1200? Not 1200.1, not 1199.99999, but exactly 1200.000000…

Exactly 1200? - answer

Answer: 0. The area of a single line under the curve is 0.

Just like the broken alarm last class: for a continuous random variable, we only ask about probabilities of intervals. This also means \(P(X < 1200) = P(X \le 1200)\).

Real SAT scores are reported in steps of 10, so some students do score exactly 1200. The normal distribution treats scores as continuous: it is a model.

Going backwards: find_normal_value()

Sometimes we know the area and want the value. What total SAT score does a test taker need to be in the top 10%?

find_normal_value("x", mean = 1000, sd = 200, area = 0.10, side = "above")
[1] 1256.31
Normal curve for X with mean 1000 and standard deviation 200. The area to the right of about 1256 is shaded pink, and the label reads Area = 0.1000.

Practice

Exercise

SAT Math scores are approximately \(N(500, 100^2)\).

  1. What is the probability that a randomly selected test taker scored above 700 on SAT Math? Sketch the picture first, then use plot_normal() and calc_prob_normal().
  2. What is the probability that a randomly selected test taker scored between 400 and 600?
  3. What SAT Math score separates the lowest 25% of test takers from the rest?

z-scores

A z-score tells us how many standard deviations a value is away from the mean.

\[z = \frac{\text{value} - \text{mean}}{\text{standard deviation}}\]

Example

A total SAT score of 1400: \(z = \frac{1400 - 1000}{200} = 2\). The score is 2 standard deviations above the mean.

If \(X\) is normal, its z-score \(Z = \frac{X - \text{mean}}{\text{standard deviation}}\) follows \(N(0, 1)\), the standard normal distribution.

Normal vs. standard normal

Two normal curves of the same shape, one above the other. The top curve is the distribution of SAT total scores, N(1000, 200 squared), with x-axis ticks at 400, 600, 800, 1000, 1200, 1400, and 1600. The bottom curve is the standard normal distribution of z-scores, N(0, 1), with x-axis ticks at -3 through 3. In both, the area above the same point (1400 on the top, z = 2 on the bottom) is shaded, and both areas equal 0.023.

A score of 1400 has \(z = \frac{1400 - 1000}{200} =\) 2. \(P(X > 1400) = P(Z > 2)\): converting to z-scores changes the numbers on the axis, not the shape or the areas.

z-scores

Exercise

SAT total scores are approximately \(N(1000, 200^2)\) and SAT Math scores are approximately \(N(500, 100^2)\).

Which is more unusual: a total SAT score of 1450 or an SAT Math score of 720?

Summary

  • A normal distribution is described by its mean and variance: \(N(\text{mean}, \text{variance})\). Check whether the second number is the standard deviation or the variance!
  • Probability = area under the curve: plot_normal() draws the area, calc_prob_normal() calculates it (value → area), and find_normal_value() goes from area → value.
  • The random variable can be a random observation (\(X\)) or a random population parameter that describes our uncertainty (\(\mu\), \(\pi\)). In a few weeks: random sample statistics (\(\bar{X}\), \(p\)).
  • A z-score is the number of standard deviations a value is from the mean. z-scores follow the standard normal distribution, \(N(0, 1)\).