The Penguin Paradox: How to Tell Three Species Apart When the Average Lies

A full classification of 344 real penguins — a bill correlation that runs backwards until you split it, then the tree, forest and PCA that read the species off a ruler. No code.

Dataset: palmerpenguins — 344 real Antarctic penguins (species, island, bill length & depth, flipper length, body mass), collected by Horst, Hill & Gorman at the Palmer research station. Download the CSV and follow along in Stratum — every figure below is a real screenshot from this file.

Here is a fact about penguins that should be impossible. In a dataset of 344 real penguins from the Palmer Archipelago in Antarctica, the longer a penguin's bill is, the shallower it tends to be. Measure bill length, measure bill depth, correlate the two, and you get −0.24 — a real, statistically significant negative relationship. Longer bills are thinner bills.

Bill length vs bill depth — a downward pooled trend that reverses within each species
Bill length vs depth. The pooled line slopes down — but split by species and every group slopes up.

That's biologically backwards — a bigger animal usually has a bigger everything — and it's the first sign a number is about to lie to you. It's the same shape of problem as the diamond paradox, where the best-graded diamonds looked cheapest: a headline relationship that runs exactly the wrong way because a hidden grouping is pulling the strings. This time the grouping is species, and cracking it is a complete tour of a classification workflow — charts, ANOVA, a decision tree, a random forest, and PCA — no code.

Step 1 — Look before you model

The dataset has three species (Adélie, Chinstrap, Gentoo) across three islands, and four measurements per bird: bill length, bill depth, flipper length, body mass. Two birds are missing measurements; Stratum simply skips them per-calculation rather than making you scrub the file first.

Now look at a variable. Histogram flipper length and you don't get one bump — you get two. Body mass does the same. A distribution with two humps is a warning: you're looking at a mixture of different things stacked into one column, and the average is describing nobody.

Histogram of flipper length showing two humps, split by species
Flipper length isn't one distribution — it's a mixture. Partitioning by species shows why.

Step 2 — The paradox, charted

Plot bill length against bill depth, one dot per penguin, and fit a line through the whole cloud: it slopes down (r = −0.24). Read literally, the chart says thinner bills are longer bills. You could ship that.

Scatter of bill length vs bill depth with a single downward linear fit
Pooled fit: a clean, significant negative slope (r = −0.24). The lie you could put on a slide.

Now color the dots by species. The single blob shatters into three tidy clusters, and inside every one the trend flips positive:

Speciesbill length ↔ bill depth
Adélie+0.39
Chinstrap+0.65
Gentoo+0.64
The same scatter colored by species, with three separate upward fit lines
The same points, colored by species with a per-group fit: three clusters, three upward lines.

Within each species, a longer bill is a deeper bill — exactly as biology predicts. The negative pooled slope was never a fact about penguins; it's an artifact of mixing three species together. The long-billed-but-shallow Gentoos sit in the bottom-right, the short-billed-but-deep Adélies in the top-left, and lining up the three clusters drags the overall line the wrong way.

Simpson's paradox. A relationship that reverses the moment you account for a group you forgot to look at. Here, species is the hidden group. It's the same trap that made better diamonds look cheaper — a confounder in disguise.

Step 3 — Every pooled correlation is suspect

A correlation matrix of the four measurements shows bill depth running negative against almost everything — bill length (−0.24), flipper length (−0.58), body mass (−0.47). All three are the same Simpson's effect: the big-bodied, shallow-billed Gentoos dragging depth the wrong way across the whole table.

Correlation matrix of the four penguin measurements
Bill depth reads negative against everything — all Simpson's artifacts. Only flipper ↔ mass (0.87) is real.

But not everything is a mirage. Flipper length vs body mass = 0.87, and that one holds up inside each species too. The lesson: a correlation across mixed groups isn't wrong — it's answering a different question than the one you asked. It describes the arrangement of the species, not the biology inside any one. The fix is never a better statistic; it's to condition — look within the groups.

Step 4 — Are the species really different?

A one-way ANOVA of flipper length by species returns F ≈ 595, p ≈ 0, with an effect size of η² = 0.78 — 78% of all flipper-length variation is explained by species alone. Bill length: F ≈ 411, η² = 0.71. These are three genuinely distinct birds, and it isn't close.

One-way ANOVA of flipper length by species in Stratum
One-way ANOVA: flipper length differs hugely across species (F ≈ 595, η² = 0.78).

But ANOVA answers "do the group averages differ?" — not "given one unlabeled bird, which species is it?" That gap, between description and classification, is the rest of this story.

Step 5 — A decision tree reads the species off a ruler

Predict species from the four measurements with a decision tree (Analyze ▸ Data Mining ▸ Decision Tree). Stratum sees a categorical response, grows a classification tree, and cross-validation-prunes it automatically. Its first question: is the flipper longer than ~207 mm? — which peels the big Gentoos off almost perfectly. Then it splits on bill length to separate the dainty Adélies from the long-billed Chinstraps. Penguin taxonomy, reconstructed from a ruler in three or four questions.

A classification tree predicting penguin species from measurements
The tree's first split is flipper length (~207 mm), isolating Gentoo; then bill length splits Adélie from Chinstrap.

Set the yardstick first: always guessing the most common species (Adélie) is right 44% of the time. The tree, scored on held-out data, lands around 94% — more than double the baseline. The honest part is the confusion matrix beside it: Gentoos essentially never missed, Adélies caught almost every time, and the only real struggle is a few Chinstraps called Adélies — the two species genuinely overlap in bill depth.

Confusion matrix for the decision tree, showing Chinstrap-Adelie confusion
The confusion matrix: Gentoo near-perfect, and the only real error is Chinstrap↔Adélie — exactly where the birds overlap.

A good model is confident where the data is clean and uncertain exactly where the data is ambiguous.

Step 6 — A forest pushes it to 98%

One tree is easy to read but brittle. A random forest (Analyze ▸ Data Mining ▸ Random Forest) grows a couple hundred trees on bootstrapped birds and lets them vote — and since each tree leaves out about a third of the data, you get validation for free (the out-of-bag estimate).

  • OOB accuracy ≈ 98% — 98 birds in 100 identified from four measurements, unlabeled.
  • ROC curves hug the top-left corner; AUC ≈ 0.997, near-perfect separability.
  • Variable importance: bill length and flipper length carry most of it, bill depth adds the detail.
ROC curves for the random forest, one per species, near the top-left corner
One ROC curve per species — all hugging the corner (AUC ≈ 0.997). Near-perfect separability.

And the payoff that ties the whole thing together: feed the forest only the two measurements from the paradox — bill length and bill depth — and it still reaches about 96%. The exact pair whose pooled correlation pointed the wrong way is, together, almost enough to separate three species. The information was never missing; it was organized by group, and the aggregate hid it.

Step 7 — PCA finds the clusters with the label thrown away

The tree and the forest both knew the answer while they learned. PCA throws the label away and asks only: what are the real axes of variation?

  • PC1 = 68.8% — loads on flipper length, body mass, and bill length together: an overall size axis.
  • PC2 = 19.3% — loads heavily on bill depth: a bill-shape axis. Two components capture 88% of everything.
PCA biplot of the penguin measurements, colored by species into three clusters
The biplot: three clean clusters fall out on PC1 (size) × PC2 (bill shape) — found without ever seeing the labels.

Plot every penguin on those two axes and color by species: three clean clusters fall right out, even though PCA was never told there were three species. A supervised forest and an unsupervised rotation agreeing on the same structure is how you know it's real — it's in the data, not in your method. And bill depth — the culprit from Step 2 — turns out to be an entire independent axis of a penguin, not noise. Pooling was flattening it.

What we actually did

Charts, a correlation matrix, ANOVA, a decision tree, a random forest, and PCA — the full arc of a classification problem, on real data, no code, about twenty minutes — turning "longer bills are shallower" into "there are three species here, and here's how to tell the next one apart with 98% accuracy."

Notice what we never needed: a dedicated discriminant analysis button. Modern trees and forests do that job and hand you a confusion matrix and ROC curves for free. That's the difference between a chart and an analysis.

The dataset is free and so is the trial. Download Stratum, load the penguins file, and see if you can beat 98% — the sexes are hiding in there as a fourth cluster.
case-study classification simpsons-paradox random-forest pca