Skip to content
Tutorials Center
My learning

Topics

Lesson 25 of 57 ยท Common Distributions

The Normal Distribution

Master the normal distribution: the bell curve, mean and standard deviation, the 68-95-99.7 rule, z-scores, standard normal tables and normal approximations, with Python.

The normal distribution, also called the Gaussian distribution or bell curve, is the most important distribution in statistics. Heights, measurement errors, test scores and many natural quantities follow it closely. Even more important, averages of many independent quantities are approximately normal whatever the original data look like, which is the content of the Central Limit Theorem. Almost every classical test and confidence interval is built on it.

The shape and its two parameters

A normal distribution is completely determined by two numbers: the mean mu (the center) and the standard deviation sigma (the spread). We write X ~ N(mu, sigma). The density is

TEXT
f(x) = 1 / (sigma * sqrt(2 * pi)) * exp(-(x - mu)^2 / (2 * sigma^2))

The curve is symmetric about mu, so mean, median and mode coincide. Changing mu slides the bell left or right; increasing sigma makes it wider and lower. The total area under the curve is always 1, and probabilities are areas.

The 68-95-99.7 rule

For any normal distribution:

  • about 68% of values lie within 1 standard deviation of the mean,
  • about 95% within 2 standard deviations,
  • about 99.7% within 3 standard deviations.
Python Checking the empirical rule

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice the "exactly 95%" line: the precise multiplier is 1.96, not 2. You will meet 1.96 again in confidence intervals.

Z-scores and the standard normal

A z-score says how many standard deviations a value lies from the mean:

TEXT
z = (x - mu) / sigma

If X ~ N(mu, sigma), then Z = (X - mu) / sigma follows the standard normal N(0, 1). This is why one table (or one function) is enough for every normal distribution: standardize, then look up Z.

Python Exam scores

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

cdf goes from a value to a probability; ppf (percent point function, the inverse CDF) goes from a probability back to a value.

Comparing across different scales

Z-scores let you compare apples with oranges. Suppose Ana scored 85 on a test with mean 75 and standard deviation 5, and Ben scored 640 on a test with mean 550 and standard deviation 60. Ana's z is 2.0 and Ben's is 1.5, so Ana did relatively better.

Python Comparing two tests

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Normal approximation to the binomial

For large n, Binomial(n, p) is close to N(n p, sqrt(n p (1 - p))). A rule of thumb is that both n p and n (1 - p) should be at least 10. Because the binomial is discrete and the normal continuous, apply a continuity correction: to estimate P(X <= k), use the normal CDF at k + 0.5.

Python Normal approximation with continuity correction

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The corrected value is much closer to the exact answer.

Is my data normal?

Real data are never exactly normal, but you can check. Make a histogram or a Q-Q plot, compare skewness and kurtosis, or use a test such as Shapiro-Wilk. A quick numeric check: compute the share of data within 1, 2 and 3 standard deviations and compare with 68/95/99.7.

Python A quick normality check

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A small Shapiro-Wilk p-value (for example below 0.05) is evidence against normality. With large samples it can flag tiny, harmless departures, so look at a plot too.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Scores are N(100, 15). What is the z-score of 130?

    z = (130 - 100) / 15 = 2.
  2. 2. Roughly what fraction of a normal distribution lies within 2 standard deviations of the mean?

    The empirical rule gives about 95% within two standard deviations.
  3. 3. Which function returns the value below which 90% of a distribution lies?

    ppf is the inverse CDF: it maps a probability to the corresponding value.
  4. 4. Why use a continuity correction?

    A discrete value k is a block from k - 0.5 to k + 0.5 on the continuous scale.

Summary

  • N(mu, sigma) is symmetric and bell-shaped, set by its mean and standard deviation.
  • About 68%, 95% and 99.7% of values lie within 1, 2 and 3 standard deviations.
  • A z-score (x - mu) / sigma converts any normal to the standard normal.
  • cdf gives probabilities, ppf gives cut-off values.
  • The normal approximates the binomial for large n (use the continuity correction).

Next: Population and Sample in Depth