Pearson Correlation and Covariance Guide
Pearson correlation standardizes linear association to −1 through 1, while covariance keeps the original measurement scale. Both start from the same paired cross-deviation sum.
Method
- Enter matched X and Y observations in the same order.
- Calculate each variable’s mean and paired deviations.
- Use the cross-deviation sum for sample or population covariance.
- Standardize the same cross-deviation sum by both variables’ spread to obtain Pearson r.
Worked example
X = 1, 2, 3 and Y = 2, 4, 6 gives r = 1, population covariance 4/3 and sample covariance 2.
Notes
- Correlation and covariance do not establish causation.
- Sample covariance divides by n − 1; population covariance divides by n.
- Pearson correlation is undefined if either variable has zero variance.
- Pearson r captures linear association. A strong curved relationship can have a modest correlation, while a single influential outlier can change r substantially. Plot or inspect paired data when interpretation matters instead of relying on the coefficient alone.
Worked four-point example with transparent numerator and denominator
Consider four hypothetical paired observations: (1, 2), (2, 4), (3, 3) and (4, 5). The X mean is 2.5 and the Y mean is 3.5. Subtract each mean to obtain X deviations of −1.5, −0.5, 0.5 and 1.5, and Y deviations of −1.5, 0.5, −0.5 and 1.5. The sum of cross-products is 2.25 − 0.25 − 0.25 + 2.25 = 4; the sum of squared deviations is 5 for X and 5 for Y.
Pearson r is the cross-product sum divided by the square root of the product of those squared-deviation sums. Here that means 4 ÷ square root of (5 × 5) = 0.80. A scatterplot would show an upward linear tendency for these four observations, but four points provide little basis for generalizing to a population. The number is an arithmetic description of the sample and does not identify a causal mechanism.
To audit calculator input, first count the pairs rather than counting all eight individual numbers as eight observations. Do not sort X and Y separately, because pairing defines the underlying data. If every X or every Y value is identical, one sum of squared deviations is zero and Pearson r is undefined. An implementation should show this limitation rather than output a seemingly meaningful zero.
- Pairs: (1, 2), (2, 4), (3, 3), (4, 5).
- Means: X = 2.5, Y = 3.5; cross-products sum = 4; squared-deviation sums = 5 each.
- Sample Pearson correlation: r = 0.80; association does not establish causality.
Pearson r measures linear association
Pearson correlation standardizes covariance so the result lies between -1 and 1. Positive values indicate that larger X values tend to accompany larger Y values, negative values indicate an inverse linear association, and values near zero indicate little linear association.
A correlation near zero does not rule out a strong curved relationship. Plot the paired data because a scatterplot can reveal nonlinearity, clusters or outliers that one coefficient cannot summarize.
Correlation does not establish causation
A large absolute correlation can arise from confounding variables, common trends, selection effects or other structures without one variable causing the other. Causal conclusions need a design and assumptions that go beyond the coefficient.
Outliers can strongly influence Pearson r. Recalculate or inspect sensitivity only as a diagnostic, and do not remove observations solely because they weaken the desired correlation.
Editorial review and limitations
Continue with the related tools
Use the linked tools for your own inputs and scenarios.
- Simple Linear Regression & Prediction Calculator — Fit a least-squares line, calculate slope, intercept, Pearson r and r squared, and optionally predict Y for a chosen X value.
- Standard Deviation Calculator — Calculate population and sample variance and standard deviation from a numeric data set.
- Z-Score & Normal Percentile Calculator — Calculate a z-score from value, mean and standard deviation, plus normal-model percentile and right-tail probability.