liveBook · Manning

Z-score

As explained in Statistics Every Programmer Needs

A z-score is a standardized measure indicating how many standard deviations an observation lies above or below a distribution's mean.

A z-score, or standard score, expresses a value’s distance from a mean in standard-deviation units: z = (x − μ) / σ. Here x is the value, μ the mean, and σ the standard deviation. A score of 0 is at the mean; a positive score is above it, and a negative score is below it. Larger absolute scores indicate greater distance. Standardizing values this way makes observations measured on different scales easier to compare. section 3.1.1 section 14.1.11

A z-score is a distance, not a probability. When a normal distribution is an appropriate model, use its cumulative distribution function (CDF) or a z-score table to find the area below a score. Do not read the probability density function’s height at a score as the probability of observing that exact value. section 3.1.1

Find a probability with SciPy

For a standard normal distribution, `norm.cdf(1)` gives about 0.8413: roughly 84.13% of values fall at or below z = 1. The area between z = 1 and z = 1.5 is `norm.cdf(1.5) - norm.cdf(1)`, or about 9.18%. In Python: `from scipy.stats import norm; print(norm.cdf(1.5) - norm.cdf(1))`. section 3.1.1

Assess a project deadline

Suppose expected project duration is 29 weeks, its standard deviation is 1.41 weeks, and the deadline is 30 weeks. The deadline’s z-score is `(30 - 29) / 1.41`, about 0.709. Assuming normally distributed completion times, `scipy.stats.norm.cdf(0.709)` gives about a 76% chance of finishing by the deadline. This estimate depends on the normality assumption and on summing critical-path activity variances under an independence assumption. A reported z-table result of 78.52% disagrees with the CDF result; check the lookup rather than treating that gap as a rounding effect. section 13.4

In quality control, z-scores help assess how far measurements or defect-rate observations lie from their process mean and whether they warrant attention. A related z-statistic in a fitted time-series model describes an estimated coefficient’s distance from zero using its estimation uncertainty; it is not a raw observation’s distance from a data-set mean. section 14.1.11 section 7.3.10

How Statistics Every Programmer Needs covers it

How deep it goes
Defines and interprets the formula, then calculates cumulative probabilities and a deadline estimate; does not establish universal intervention thresholds.
Examples
Uses standard-normal CDF values and a 30-week project deadline; also applies the measure to quality-control observations.
What it assumes
Builds the score from the mean and standard deviation, and assumes a normal model when converting it to probability.
What you can do after
Apply it via SciPy to estimate normal-distribution probabilities, while checking the underlying assumptions and reported results.
How it connects
Links standard deviation and the normal distribution to cumulative probability, critical-path variance, and control charts.

Also explained in

Compare how 8 books explain z-score →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.