Correlation and the Correlation Coefficient
Across an island archipelago, biologists notice a pattern. Species with longer wings also tend to have longer tails. Is this a strict rule, a loose tendency, or a coincidence? They only caught ten birds. Biology is full of paired measurements like this. Examples include height and weight, gene expression and drug response, temperature and metabolic rate. Researchers constantly need a single number to capture how tightly two variables move together. That number is the correlation coefficient. Understanding it precisely is one of the most consequential skills in quantitative biology. It is also one of the most widely misused. Correlation matters because organisms are bundles of covarying traits. Ecosystems, too, are webs of covarying variables. But covariation is cheap, while causation is expensive to establish. A single correlation coefficient can summarize a scatterplot of thousands of points. That same compression can hide curvature, outliers, or a lurking third variable driving both measured quantities. Learning to compute Pearson's r is foundational. So is learning to interpret its magnitude and sign correctly, and to recognize when its assumptions are violated. These skills underlie everything in Simple Linear Regression and formal Inference for Correlation. The big picture is this: correlation quantifies the strength and direction of a linear relationship between two continuous variables. It does so on a scale from −1 to +1, using standardized covariance. It says nothing, by itself, about which variable (if either) causes the other. It also says nothing reliable about relationships that are strong but curved. This article builds the concept from its algebraic definition. It then explores the geometry and mechanics of how r behaves. Next comes the classic evidence that shaped how biologists think about correlation — including Karl Pearson's founding work and Francis Galton's earlier discovery of regression to the mean. Finally, it turns to worked numerical examples and the traps that catch even careful researchers. By the end, you should be able to compute r by hand from raw data. You should be able to explain in your own words why r is dimensionless and bounded. You should also recognize the four situations where r badly misleads: nonlinearity, outliers, restricted range, and subgroup pooling. Finally, you should situate correlation correctly relative to causation, Observational vs Experimental Studies, and the machinery of regression that follows it.
- Pearson's correlation coefficient r measures the strength and direction of linear association between two continuous variables; it ranges from −1 to +1.
- r is the standardized covariance: covariance divided by the product of the two standard deviations, which strips away units and scale.
- r = 0 means no linear trend — it does not mean no relationship at all; strong curved relationships can have r near zero.
- r² ("coefficient of determination") gives the proportion of variance in one variable statistically associated with the other.
- Correlation is symmetric and says nothing about causal direction; it is easily distorted by outliers, nonlinearity, and pooling distinct subgroups.
- Galton's sweet-pea experiments and Pearson's mathematical formalization of r (1896) turned "related traits" into a precise, testable number.
The correlation coefficient r measures only how tightly two variables track each other in a straight line, on a fixed scale from −1 to +1, and implies nothing about which variable — if either — causes the other.
The core idea
Correlation describes the tendency of two variables to vary together — to increase or decrease jointly across the individuals or observations being studied. When larger values of variable X tend to co-occur with larger values of variable Y, the variables are said to be positively correlated (wing length and tail length in birds, body mass and metabolic rate). When larger X tends to co-occur with smaller Y, they are negatively correlated (clutch size and egg size across bird species, often; predator density and prey density in some systems). When there is no consistent linear tendency either way, the variables are uncorrelated. The workhorse statistic for continuous data is the Pearson product-moment correlation coefficient, denoted r for a sample and ρ (rho) for the true population parameter. It is built directly from covariance, the un-standardized measure of joint variation:
Covariance has a serious defect: its magnitude depends on the units of X and Y. Measuring wing length in millimeters instead of centimeters multiplies the covariance by ten, even though nothing about the biological relationship has changed. Pearson's fix was to standardize covariance by dividing by the product of the two standard deviations:
This division cancels units entirely — r is a pure number, always between −1 and +1, regardless of whether X and Y are measured in millimeters, grams, or degrees Celsius. A value of r = +1 or −1 indicates a perfect linear relationship (every point lies exactly on a line); r = 0 indicates no linear trend. The sign of r always matches the sign of the covariance, and it tells you whether the best-fit line through the cloud of points slopes upward or downward.
Mechanism — how r actually behaves
Step 1: Center the data. For every observation, subtract the sample mean of X from each x-value, and the mean of Y from each y-value. This shifts the origin of the scatterplot to the point (x̄, ȳ), the centroid of the cloud.
Step 2: Form cross-products. For each individual, multiply its centered x-deviation by its centered y-deviation. A point in the upper-right or lower-left quadrant (relative to the centroid) contributes a positive product; a point in the upper-left or lower-right contributes a negative product. Summing these products over all individuals gives the numerator of the covariance — it is literally a tally of how consistently points fall into the "same-direction" quadrants versus the "opposite-direction" quadrants.
Step 3: Standardize by spread. Dividing by s_X s_Y rescales this tally into units of "standard deviations of X times standard deviations of Y," which is exactly what cancels the original measurement units and bounds the result to [−1, 1]. This boundedness is not arbitrary — it is a direct consequence of the Cauchy–Schwarz inequality, which guarantees that a sum of cross-products can never exceed the product of the two sums of squared deviations.
Step 4: Interpret magnitude, not just sign. |r| close to 1 means the points hug a straight line tightly; |r| close to 0 means the points are a diffuse cloud with no linear trend (or a trend that is not linear — see below). A useful complementary quantity is the coefficient of determination, r², which is the proportion of the total variance in Y that is statistically associated with variance in X under a linear model. An r of 0.7 sounds strong, but r² = 0.49 — under half the variance is shared.
Step 5: Recognize what breaks it. Pearson's r specifically detects linear association. Four situations systematically distort it:
- Nonlinearity — a perfect U-shaped or saturating relationship can produce r near 0 even though Y is completely determined by X.
- Outliers — because the formula uses squared and cross-product terms, a single extreme point can inflate or deflate r dramatically, especially in small samples.
- Restricted range — if the observed X values span only a narrow slice of their natural range, r is attenuated even when the true underlying relationship is strong.
- Pooling heterogeneous subgroups — combining two or more groups that each have little internal correlation, but that differ in their mean X and mean Y, can create a spurious r far from zero (an instance of Simpson's-paradox-like confounding).
The evidence
The idea of correlation entered biology before it had a name attached to a formula. Francis Galton, working in the 1870s–1880s on inheritance, wanted to know how strongly offspring traits resembled parental traits. His most famous dataset came from sweet pea seeds (1875–1877): he distributed seeds of different diameters to friends around Britain, had them grown under controlled conditions, and measured the diameters of the offspring seeds. Galton found that offspring from unusually large parent seeds were, on average, larger than offspring from unusually small parent seeds — but less extreme than their parents. Large parents produced somewhat-large-but-not-as-large offspring; small parents produced somewhat-small-but-not-as-small offspring. Galton called this phenomenon "regression toward mediocrity" (later softened to regression to the mean), and he plotted parent seed diameter against offspring seed diameter, drawing smoothed lines through the data — an early scatterplot and an early regression line, though he lacked a formal coefficient. He extended the same logic to human height in his 1886 study of 928 adult children and their parents (using a combined "mid-parent" height), finding the identical pattern: children of tall parents tended to be taller than average but shorter than their parents; children of short parents tended to be shorter than average but taller than their parents. The relationship was real, consistent, and directional — but not perfectly predictive, and it visibly weakened (regressed) toward the population mean at each generation. Galton had discovered the phenomenon of correlated, imperfectly transmitted traits, but it was his protégé and later rival, the mathematician Karl Pearson, who in 1895–1896 gave it rigorous algebraic form. Pearson derived the product-moment formula for r essentially as it is taught today, building on ideas from the French mathematicians Auguste Bravais and from Galton's own geometric constructions. Pearson showed that the slope of Galton's regression line and the "index of correlation" were mathematically linked, and that r could be computed directly from means, variances, and the sum of cross-products of two variables — turning a qualitative observation ("tall parents tend to have tall children, but less extremely so") into a single, reproducible, dimensionless number that could be tested statistically and compared across datasets. What this body of work established, and what later replications across thousands of biological datasets have confirmed, is threefold: 1. Continuous biological traits genuinely covary — parent-offspring resemblance, organ sizes within an individual, and physiological variables across species show reproducible linear associations, not just anecdotal impressions. 2. The strength of that covariation can be measured on a universal, unit-free scale (−1 to +1), allowing direct comparison of, say, the height–weight correlation in humans to the wing–tail correlation in birds. 3. Correlation and causation are logically separable — Galton's regression-to-the-mean finding is itself a caution against naive causal readings: an extreme parent value predicts a less extreme offspring value not because of a mysterious "regressive force" acting on inheritance, but as an inevitable statistical consequence of an imperfect correlation (|r| < 1) between two variables, some of which arises from environmental noise and Mendelian segregation, not any dampening mechanism.
Worked examples
Example 1 — a small ecological dataset computed by hand. Suppose a field ecologist measures leaf nitrogen content (percent dry mass, X) and herbivore damage (percent leaf area consumed, Y) on eight randomly sampled saplings of the same species:
| Sapling | X (N%) | Y (damage %) |
|---|---|---|
| 1 | 1.2 | 3 |
| 2 | 1.8 | 9 |
| 3 | 2.5 | 14 |
| 4 | 1.5 | 5 |
| 5 | 3.1 | 22 |
| 6 | 2.0 | 10 |
| 7 | 2.8 | 19 |
| 8 | 1.1 | 2 |
Step 1: Means. x̄ = (1.2+1.8+2.5+1.5+3.1+2.0+2.8+1.1)/8 = 16.0/8 = 2.00 ȳ = (3+9+14+5+22+10+19+2)/8 = 84/8 = 10.50 Step 2: Deviations and cross-products (dx = x−x̄, dy = y−ȳ):
| Sapling | dx | dy | dx·dy | dx² | dy² |
|---|---|---|---|---|---|
| 1 | −0.80 | −7.50 | 6.00 | 0.64 | 56.25 |
| 2 | −0.20 | −1.50 | 0.30 | 0.04 | 2.25 |
| 3 | 0.50 | 3.50 | 1.75 | 0.25 | 12.25 |
| 4 | −0.50 | −5.50 | 2.75 | 0.25 | 30.25 |
| 5 | 1.10 | 11.50 | 12.65 | 1.21 | 132.25 |
| 6 | 0.00 | −0.50 | 0.00 | 0.00 | 0.25 |
| 7 | 0.80 | 8.50 | 6.80 | 0.64 | 72.25 |
| 8 | −0.90 | −8.50 | 7.65 | 0.81 | 72.25 |
| Σ | 37.90 | 3.84 | 378.00 |
Step 3: Assemble.
This is a very strong positive correlation: leaf nitrogen and herbivore damage rise together almost perfectly linearly in this sample, with r² ≈ 0.99 — about 99% of the variance in damage is statistically associated with nitrogen content. Biologically, this is consistent with nitrogen being a limiting nutrient for herbivores, making high-nitrogen leaves disproportionately attractive — but this dataset, being observational (see Observational vs Experimental Studies), cannot by itself rule out a third factor (e.g., leaf toughness declining with nitrogen) driving both.
Example 2 — restricted range distorts a clinical correlation. A hospital wants to know whether fasting blood glucose predicts HbA1c (a marker of average blood sugar over ~3 months) in its diabetic clinic population. Using all 400 patients seen in a year, glucose ranges from 70–350 mg/dL and the correlation is:
A junior analyst, however, only has access to the subset of patients who were already well-controlled and re-tested for a drug trial — glucose restricted to 90–130 mg/dL (a much narrower slice). Recomputing on this subset gives:
The underlying biological relationship between glucose and HbA1c has not changed — the same physiological mechanism (glucose binding hemoglobin) operates in both groups. What changed is the range of X observed: within a narrow glucose band, most of the variation in HbA1c is driven by other factors (measurement noise, red blood cell turnover rate, hemoglobin variants), so the linear signal is proportionally swamped. This is a direct illustration of range restriction attenuating r, and it is exactly why clinical reference correlations must report the range of the sample they were computed on — a correlation of 0.31 might wrongly be reported as "glucose is a weak predictor of HbA1c," when in fact it is a strong predictor over the full physiological range and the analyst's subsample simply had too little spread in X to detect it.
Common misconceptions & traps
| Misconception | Why it's wrong |
|---|---|
| "Correlation implies causation." | r is symmetric in X and Y and blind to mechanism; a third (confounding) variable can drive both, or the association can be coincidental. |
| "r = 0 means the variables are unrelated." | r = 0 only rules out a linear trend; strong curved (quadratic, sigmoidal) relationships can have r near zero. |
| "A bigger sample always gives a more trustworthy r." | Sample size affects the precision (standard error) of r's estimate, not whether outliers, nonlinearity, or pooling bias it. |
| "r = 0.6 means twice as strong a relationship as r = 0.3." | r is not a ratio scale in that sense; compare r² (variance explained) — 0.36 vs 0.09, a fourfold difference in explained variance. |
| "Correlation and the slope of the regression line are the same thing." | r is unit-free and bounded; the regression slope b depends on the units and scales of X and Y and is unbounded. |
| "Pooling two groups can only wash out real correlations, not create fake ones." | Combining groups that differ in their means on both variables can create a strong spurious r even when neither group shows any internal correlation (a form of ecological/Simpson's-type confounding). |
The scientist behind it
Origins · 1 minKarl Pearson and how this was discovered
Karl Pearson trained as a mathematician and lawyer before turning to applied statistics under the influence of Francis Galton's work on heredity. As the first Galton Professor of Eugenics at University College London (a title and research program now recognized as scientifically and ethically fraught, entangled with the eugenics movement of the era), Pearson formalized much of the mathematical toolkit still used across biology and medicine today: the product-moment correlation coefficient, the chi-squared test, and the method of moments for fitting distributions. His 1896 paper "Mathematical Contributions to the Theory of Evolution: Regression, Heredity, and Panmixia" gave the correlation coefficient its modern algebraic definition and connected it rigorously to Galton's earlier, more graphical notion of "co-relation."
Where this matters today
Genomics and gene expression. Correlation coefficients underlie co-expression network analysis (e.g., WGCNA), where genes whose expression rises and falls together across samples (high pairwise r) are grouped into modules, guiding hypotheses about shared regulatory pathways — always with the caveat that co-expression is not proof of direct regulatory interaction.
Clinical biomarker validation. Before a new blood biomarker (e.g., a novel inflammatory marker) is adopted, its correlation with an established gold-standard measure is reported, alongside the range of values tested — a lesson directly foreshadowed by the glucose/HbA1c range-restriction example above.
Ecology and conservation. Correlations between habitat variables (canopy cover, distance to water, prey density) and species occurrence or abundance guide conservation prioritization, though ecologists are trained to treat these as hypothesis-generating, not causally conclusive, pending manipulative field experiments.
Agriculture and quantitative genetics. Breeders use trait correlations (e.g., between early growth rate and final yield) to design selection indices, directly descended from Galton and Pearson's original parent–offspring correlation framework, now formalized through heritability and genetic correlation estimates.
Pharmacology and toxicology. Dose–response relationships are often first screened via correlation before fitting explicit dose-response curves (sigmoidal models), since a near-zero r on raw dose vs. response can flag that a nonlinear model, not a linear one, is needed — a direct application of recognizing when r is the wrong tool.
Ask the tutor: If two variables show a strong Pearson correlation but a scatterplot reveals an obvious curve, what should I compute or plot instead to properly capture their relationship?
Is r always between −1 and 1, and what do the extreme values mean?
Yes — this bound is guaranteed mathematically by the Cauchy–Schwarz inequality applied to the centered data vectors. An r of exactly +1 means every data point lies precisely on an upward-sloping straight line (perfect positive linear relationship); r of exactly −1 means every point lies precisely on a downward-sloping line. In real biological data, exact ±1 values essentially never occur outside of deterministic mathematical relationships (e.g., converting the same quantity between two unit systems), because biological measurements always carry some independent noise, individual variation, or measurement error that keeps points off a perfect line.
What's the difference between correlation and covariance, and why not just use covariance?
Covariance measures joint variation in the original units of the two variables, so its magnitude is not comparable across different variable pairs or measurement scales — a covariance of 500 could reflect either a very strong or very weak relationship depending on what units and variances are involved. Correlation solves this by dividing covariance by the product of the two standard deviations, yielding a dimensionless number bounded between −1 and 1. This standardization is precisely why correlation coefficients can be meaningfully compared across entirely different studies, species, and variable types, while raw covariances cannot.
Can r be used for categorical or ordinal variables?
Pearson's r is designed for two continuous (interval or ratio scale) variables and assumes the relationship, if any, is linear. For ordinal data (ranks) or data with a monotonic but non-linear relationship, the Spearman rank correlation coefficient is typically preferred, since it correlates the ranks of the observations rather than their raw values, making it robust to nonlinear-but-monotonic trends and less sensitive to outliers. For strictly categorical (nominal) variables, different association measures such as the chi-squared-based Cramér's V are used instead.
How does sample size affect interpretation of r?
Sample size does not change the true strength of a linear relationship, but it changes how precisely and reliably a sample r estimates the population ρ. A correlation of r = 0.4 computed from only 8 data points is statistically far less trustworthy (wider confidence interval, more sensitive to any single point) than the same r = 0.4 computed from 2,000 data points. Formal hypothesis testing of whether an observed r differs significantly from zero — covered under Inference for Correlation — explicitly incorporates sample size through a t-distributed test statistic.
Why did Galton call it "regression to mediocrity" and is that the same thing as correlation?
Regression to the mean and correlation are closely linked but distinct concepts. Correlation (r) measures how tightly two variables track together; regression to the mean is the consequence of an imperfect correlation (any |r| < 1) combined with extreme values in one variable — it describes why the predicted value of Y for an extreme X is, on average, less extreme (closer to the mean) than X itself. Galton observed this pattern in sweet pea seeds and human heights before Pearson supplied the algebraic correlation coefficient that explains why it happens mathematically, whenever the correlation between the two variables is less than perfect.
What causes a correlation to be spuriously created by pooling groups?
If two or more subgroups each have little or no internal correlation between X and Y, but the subgroups differ systematically in their mean X and mean Y values, combining them into one dataset can produce an apparent strong correlation driven entirely by the between-group differences in means, not by any real within-group relationship. For example, if species A has low average leg length and low average speed, while species B has high average leg length and high average speed, but neither species shows a leg–speed correlation within itself, pooling both species together can manufacture a misleadingly strong overall r. This is why biologists check for this artifact — a version of Simpson's paradox — by plotting subgroups separately before trusting a pooled correlation.
Does a correlation of zero mean two variables are statistically independent?
Not necessarily. Statistical independence is a stronger condition than zero correlation: independent variables always have r = 0, but variables with r = 0 are not necessarily independent, because r only detects linear association. A classic example is Y = X² for X symmetric around zero — Y is completely determined by X (they are strongly dependent), yet the linear correlation between them can be exactly zero, because positive and negative X values produce the same Y, canceling out the linear trend entirely.