Pearson correlation coefficient calculator guide
Pearson’s correlation coefficient r measures the direction and strength of a linear relationship between two quantitative variables. It ranges from −1 to 1 and is unchanged by switching the X and Y labels.
The scatterplot is essential: a coefficient can hide curvature, clusters, and influential observations. Correlation describes association, not causation, and a value near zero rules out only a strong linear pattern—not every possible relationship.
How to calculate Pearson correlation
- Enter paired data: Enter X values and Y values in matching order with the same number of observations.
- Calculate: Select Calculate Pearson r to compute the coefficient, R squared, and fitted line.
- Inspect the scatterplot: Look for curvature, separate clusters, restricted ranges, and influential points before interpreting r.
- Interpret in context: Describe direction, magnitude, sample, and uncertainty without claiming that association proves causation.
Formula and variables
The numerator measures how paired deviations vary together. The denominator scales by the variability in X and Y, making r unit-free.
r = Σ[(xi − x̄)(yi − ȳ)] / √{Σ(xi − x̄)² Σ(yi − ȳ)²}- xi, yi — Paired observations
- The ith values of X and Y.
- x̄, ȳ — Sample means
- Arithmetic means of the X and Y lists.
- r — Pearson correlation
- Unit-free linear association from −1 to 1.
A perfect positive linear relationship
Pair X = 1, 2, 3, 4, 5 with Y = 2, 4, 6, 8, 10.
- X
- 1, 2, 3, 4, 5
- Y
- 2, 4, 6, 8, 10
- Center each X and Y value around its sample mean.
- Sum the paired deviation products.
- Divide by the square root of the two deviation sums of squares.
Result: r = 1, R² = 1, and the fitted line is y = 2x.
Every point lies exactly on an increasing straight line. This mathematical association alone does not establish a causal mechanism.
Understanding your results
Pearson r
The sign gives direction; the absolute value gives the closeness of points to a straight-line pattern. Appropriate magnitude labels depend on the field, measurement reliability, range, and decision context.
R squared and fitted line
For simple linear regression with an intercept, R squared equals r². The displayed line minimizes squared vertical residuals for predicting Y from X; unlike r, its slope changes if X and Y are swapped.
Assumptions
- Values are paired correctly and each pair represents the same observational unit.
- Both variables are quantitative.
- Observations are independent when inferential conclusions are intended.
- A linear summary is scientifically meaningful for the relationship.
- Neither variable is constant.
Limitations
- No confidence interval, p-value, rank correlation, partial correlation, or robust correlation is calculated.
- Pearson r can be strongly affected by outliers and restricted ranges.
- A nonlinear relationship can have r near zero.
- R squared is not automatically the fraction of causal variation explained.
- Two points always define a perfect straight line, so larger samples are needed for meaningful inference.
Common mistakes
- Sorting X and Y separately and destroying the original pairing.
- Claiming causation from correlation alone.
- Ignoring an influential point or nonlinear pattern visible in the scatterplot.
- Using Pearson r for categorical variables.
- Interpreting the regression slope as though it were unit-free.
Practical use cases
Exploratory analysis
Summarize the linear association between two measurements and inspect their scatterplot.
Regression checks
Compare r, R squared, and the fitted simple linear trend before moving to a fuller model.
Planning and decision guide
Plot before reporting
Define the population, pairing, and variables before analysis. Report the scatterplot and sample size alongside r, and use domain-specific standards and uncertainty estimates for decisions.
Frequently asked questions
What range can Pearson r take?
Pearson r ranges from −1 to 1. The sign indicates direction and the absolute value indicates strength of the linear pattern.
Why is correlation undefined for a constant data set?
A constant variable has zero variance, so the denominator of the correlation formula is zero.
Does r = 0 mean there is no relationship?
No. It means there is no linear association in the sample; a nonlinear relationship may still be present.
Is correlation the same if I swap X and Y?
Yes, Pearson r is symmetric. The least-squares regression equation is not symmetric because it predicts one variable from the other.
Does correlation prove causation?
No. Confounding, reverse direction, selection, and chance can produce an association without the proposed causal mechanism.
Sources and review
- CORRELATION — NIST Dataplot Reference Manual. Accessed 2026-08-29.
- Describing Data, Part 2: Correlation — Penn State Eberly College of Science. Accessed 2026-08-29.
Reviewed 2026-08-29.