Contents/ Part II · Describing Data/ Chapter 11

Shape of a Distribution

Center tells you where the data sits. Spread tells you how wide it runs. Shape tells you what its silhouette looks like: which way it leans, how heavy its tails are, and how many peaks it has.

⏱️ ~12 min read
🐍 Notebook included
📊 Chapter 11

Two datasets can share the same mean and the same standard deviation and still look nothing alike. The missing piece is shape: the third descriptive pillar after center and spread.

The shape of a distribution describes its silhouette through three questions: is it symmetric or skewed, how heavy are its tails (kurtosis), and how many peaks does it have (modality)?
🧱
The third pillar

The Measures of Central Tendency chapter gave you center, Measures of Dispersion gave you spread. Shape completes the trio. It is also what connects back to position: skew is exactly what makes the median pull away from the mean.

1

Symmetry & Skewness

A symmetric distribution mirrors itself around its center. A skewed one has one tail stretched longer than the other. The golden rule for naming it: name the skew by the tail that stretches, not by where the bulk of the data sits.

Left-skewed tail points left · mean < median < mode Symmetric balanced · mean ≈ median ≈ mode Right-skewed tail points right · mode < median < mean mode median mean
The mean chases the tail: extreme values tug the mean toward the long side, while the median stays in the bulk.
🧲
The mean chases the tail

For a typical smooth, unimodal distribution, the ordering of the three centers signals the skew: right skew → mode < median < mean, left skew → mean < median < mode. A fast hand check is the gap mean − median: positive leans right, negative leans left.

⚠️
It is a tendency, not a law

That mean-median-mode ordering "fails with surprising frequency," especially for discrete or multimodal data. The statement that is always safe: positive skewness means the right tail is longer or heavier. Treat the ordering as the usual companion, not a guarantee.

Software reports skew as a single number (the Fisher-Pearson moment coefficient). A common reading:

|skew| < 0.5

Fairly symmetric.

0.5 to 1

Moderately skewed.

≥ 1

Highly skewed.

The sign gives direction (+ right, − left); the magnitude gives severity. These cutoffs are heuristics, not hard law, and depend on sample size.

2

Modality: Counting the Peaks

Modality is simply how many peaks the distribution has. It is one of the most useful shape clues in practice.

Unimodal

One clear peak. Most textbook distributions, including the bell curve.

Bimodal

Two distinct peaks, a strong hint of two mixed groups.

Multimodal

Three or more peaks.

Uniform

No peak; values roughly equally likely, like a fair die.

🔍
Two peaks usually mean two groups

A bimodal shape is the data telling you to disaggregate. Adult heights (men and women), exam scores (studied vs. did not), restaurant traffic (lunch and dinner rushes): each is two subpopulations stacked together. The overall mean lands in the empty valley between the humps and describes almost nobody.

Careful with words here: the number of peaks ("modes" in the shape sense) is not the same as the single mode statistic from the Measures of Central Tendency chapter.

3

Kurtosis: It Is About the Tails

Kurtosis is the most misunderstood shape statistic. For over a century textbooks called it "peakedness." That framing is now considered wrong. Kurtosis measures tailedness: how outlier-prone a distribution is, how much probability lives far from the center.

look here: the tails Leptokurtic · heavy tails (excess > 0) Mesokurtic · normal (excess ≈ 0) Platykurtic · light tails (excess < 0)
The peaks differ too, but that is a distraction. What kurtosis actually pins down is the weight in the tails.
TypeExcess kurtosisTailsExample
Mesokurtic≈ 0Normal-likeThe normal distribution
Leptokurtic> 0Heavy, outlier-proneFinancial returns, t-distribution
Platykurtic< 0Light, few outliersThe uniform distribution
3️⃣
Raw 3 vs. excess 0

A normal distribution has raw kurtosis 3. Most software subtracts that to report excess kurtosis, so a normal shape reads 0. SciPy's kurtosis() returns excess by default. Always state which convention you mean.

4

Reading Shape, and Why It Matters

Four views reveal shape, each with a catch:

📊

Histogram

The workhorse for modality and skew. But the bin width can hide or invent peaks, so try a few.

〰️

Density / KDE

A smoothed histogram, cleaner for comparing groups; the smoothing bandwidth is the knob here.

📦

Box plot

Asymmetric whiskers flag skew; far-out points flag heavy tails. It cannot show modality, though.

📐

Q-Q plot

Points on the diagonal mean normal; a curved "banana" means skew; bowed-out ends mean heavy tails.

🤖
Why shape matters for data science

Many classic methods assume roughly symmetric, light-tailed data: t-tests, ANOVA, linear regression (normal residuals), and confidence intervals built on the normal curve. Skew makes the mean misleading, so report the median for skewed quantities like income. Heavy tails mean outlier risk, which is central to anomaly detection and financial risk models.

🪵
The log transform: a practical lever

For strictly positive, right-skewed data spanning orders of magnitude (income, prices, counts), a log transform compresses the large values and pulls the tail in, often making the shape nearly symmetric. Two limits: the log is undefined at zero or negatives (use log1p or a shift), and your numbers now live on a log scale, so interpret accordingly.

A natural next step from shape is putting any value on a common scale. That is the z-score, the subject of the Standardization & Z-Scores chapter.

5

Distribution Shape in Machine Learning & AI

A feature's shape decides how you should treat it. Skew and heavy tails are the reasons behind some of the most common preprocessing steps, and behind why some models struggle with raw data.

Shape featureWhere it shows up in MLWhat you do about it
Right skewSkewed features (prices, counts, durations) break the symmetry many models expectA log or power transform pulls the tail in and often improves the fit
Heavy tails (high kurtosis)Outlier-prone features and residuals inflate error and destabilize trainingUse robust losses or scalers, or clip and winsorize the extremes
NormalityLinear models, LDA, and many tests assume roughly normal residuals or featuresCheck the shape first (a histogram or QQ plot) before trusting those assumptions
🤖
The log transform is a shape fix

When a practitioner reaches for log1p on a price or count column, they are correcting skew, turning a long-tailed feature into a near-symmetric one so a model that assumes symmetry can do its job. Reading the shape is what tells you the transform is needed in the first place.

6

Real-World Example: The Shape of Insurance Claims

Insurance claims are a textbook heavy-tailed distribution: most are modest, a few are enormous. This set of 600 claims is strongly right-skewed (skewness about 3.7) with fat tails (high kurtosis), so the mean sits well above the median. The companion notebook measures its skewness and kurtosis, and shows a log transform pulling it back toward symmetry.

📂 Dataset · shape-of-a-distribution--insurance_claims.xlsx

One row per claim: claim_id, region (North, South, East, West), and claim_amount in US dollars. The amount column is deliberately heavy-tailed, so it shows positive skewness and high kurtosis clearly, and responds well to a log transform.

🐍

Bring it to life in Python

The companion notebook plots symmetric, skewed, and bimodal samples with their skew and kurtosis, shows the mean chasing the tail, proves kurtosis is about tails not peaks, splits a bimodal mixture, and tames a long tail with a log transform.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub

View opens the rendered notebook instantly (no setup). Open in Colab runs & edits it live in your browser. To run locally, install numpy, pandas, scipy, matplotlib and launch jupyter notebook.

🎓 Key Takeaways

  • Shape is the third descriptive pillar: symmetry, tails, and modality.
  • Skewness is named by the stretched tail; the mean chases the tail, so mean > median signals right skew.
  • Kurtosis is about tails (outlier-proneness), not peak height; normal excess kurtosis is 0.
  • A bimodal shape usually means two subpopulations are mixed; split them.
  • Shape drives method choice: report the median for skewed data, and a log transform can straighten a long right tail.
7

Practice Challenges

Five short challenges, beginner to intermediate. Try them on paper or in Python before checking the solutions.

1

Name the skew

House prices have a mean of 420,000 and a median of 350,000. Is the data left- or right-skewed, and which number better describes a typical home?

Hint: the mean chases the tail. Which side is it pulled toward?
2

Measure the skew

Generate rng.exponential(scale=5, size=3000), compute its skewness with SciPy, and classify it with the 0.5 / 1 rule of thumb.

Hint: scipy.stats.skew; sign gives direction, size gives severity.
3

Kurtosis means tails

Compute the excess kurtosis of a normal sample and a Laplace sample of the same size. Label each mesokurtic / leptokurtic / platykurtic and say what it implies.

Hint: scipy.stats.kurtosis returns excess (normal ≈ 0).
4

Two peaks

A step-count histogram shows peaks near 3,000 and 11,000 steps. What does this shape most likely mean, and what should the analyst do?

Hint: where would a single overall average land?
5

Tame the tail

For rng.lognormal(mean=2, sigma=1, size=4000), report the skewness, apply a log transform, and report it again. Explain what changed and give one caveat.

Hint: np.log; what happens to a long right tail?
Check your work

A fully-worked solutions notebook walks through all five challenges in the same visual style. Try them yourself first, then compare.

📓 View Solutions ▶ Open Solutions in Colab ⬇ View / Download on GitHub
8

Quiz: Test Yourself

Eight quick questions on shape. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.