Areas from z-scores · Statistics & Data Science Class… | StemPy Lab
Course 4.3·Lesson 2 of 3
Areas from z-scores
A z-score turns any normal curve into the standard normal curve, with mean 0 and standard deviation 1. Areas under it give the share below, above or between values. We read them from a short table or from Python's statistics.NormalDist, and we run it backwards to find a percentile.
about 25 min
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
turn a value into a z-score, and a z-score into an area;
find the share below, above and between values of a normal distribution;
find the value with a given share below it.
Bolts from a made-up machine
A made-up machine makes bolts. Their lengths follow a normal curve with mean 50.0mm and standard deviation 0.2mm. What share of bolts is shorter than 49.7mm? The 68-95-99.7 rule cannot answer, because 49.7mm is not a whole number of standard deviations from the mean.
The z-score
The z-score of a value says how many standard deviations it lies from the mean:
z=σx−μ.
For 49.7mm, z=0.249.7−50.0=−1.5. A negative z-score means below the mean. You met z-scores in the chapter on describing distributions. Here they do more: every normal distribution, turned into z-scores, becomes the standard normal distribution, N(0,1). So one curve answers every question.
The area to the left of z under N(0,1) is written Φ(z). The Greek letter Φ is called phi.
A short table
Φ(0)=0.5 and Φ(0.5)=0.6915
Φ(1)=0.8413 and Φ(1.5)=0.9332
Φ(2)=0.9772 and Φ(2.5)=0.9938
Φ(3)=0.9987
For a negative z, use the symmetry of the curve: Φ(−z)=1−Φ(z). Some books print a table of the area between 0 and z instead. That is Φ(z)−0.5, so check the heading of a table first.
Below, above and between
Below. Shorter than 49.7mm: Φ(−1.5)=1−0.9332=0.0668, about 6.7% of bolts.
Above. Longer than 50.5mm: z=2.5, so 1−Φ(2.5)=1−0.9938=0.0062.
Between. From 49.8mm to 50.3mm: z=−1 and z=1.5, so Φ(1.5)−Φ(−1)=0.9332−0.1587=0.7745.
A normal curve for made-up bolt lengths with mean 50.0 mm and standard deviation 0.2 mm, with the axis from 49.4 mm to 50.6 mm. The region from 49.8 mm to 50.3 mm is shaded, and a second axis below gives the matching z-scores, -1 and 1.5.
You should find that the area between two ends is always the larger left area minus the smaller one. Put the ends at −2 and 2, and the area is 0.9545, the middle of the 68-95-99.7 rule.
Backwards: from a share to a value
Which length has 90% of bolts below it? This value is the 90th percentile. Find the z-score with Φ(z)=0.90. It is about 1.2816. Then turn it back into a length: x=μ+zσ=50.0+1.2816×0.2≈50.256mm.
Try it in Python
Python's statistics module has a ready normal distribution. cdf(x) gives the area to the left of x, and inv_cdf(share) runs backwards.
Your turn
The usual mistakes
Using Φ(z) for the share above. The table gives the area to the left. For above, use 1−Φ(z).
Dropping the sign of z. A value below the mean has a negative z-score.
Adding areas to find "between". Take the smaller left area away from the larger one.
Reading the wrong kind of table. Check whether it gives the area to the left of z or from 0 to z.