Pearson Correlation Calculator
Measure linear relationship strength.
Independent variable
Dependent variable
Load example data:
Enter paired X and Y values to calculate correlation
Minimum 3 pairs required, both columns must have equal length
What Is Pearson Correlation?
Pearson correlation coefficient () measures the strength and direction of the linear relationship between two continuous variables. It quantifies how closely data points follow a straight line.
Question answered: "How strongly are these two variables linearly related?"
Examples:
- "How strongly does study time relate to exam scores?"
- "Is there a relationship between height and weight?"
- "Do advertising spending and sales move together?"
The Correlation Coefficient
ranges from -1 to +1:
| Value | Interpretation |
|---|---|
| r = +1 | Perfect positive correlation |
| r = +0.7 to +1 | Strong positive |
| r = +0.4 to +0.7 | Moderate positive |
| r = +0.2 to +0.4 | Weak positive |
| r = 0 | No linear relationship |
| r = -0.2 to -0.4 | Weak negative |
| r = -0.4 to -0.7 | Moderate negative |
| r = -0.7 to -1 | Strong negative |
| r = -1 | Perfect negative correlation |
Understanding Direction
Positive correlation (): As X increases, Y tends to increase. Example: Height and weight
Negative correlation (): As X increases, Y tends to decrease. Example: Price and demand
Zero correlation (): No linear pattern. Note: Non-linear relationships may have !
The Formula
Or equivalently:
Where:
- = sum of cross-products of deviations
- = sum of squared deviations for X
- = sum of squared deviations for Y
Example Calculation
Data: Study hours (X) and exam scores (Y)
| Hours | Score |
|---|---|
| 2 | 65 |
| 3 | 70 |
| 4 | 72 |
| 5 | 80 |
| 6 | 85 |
Calculations:
- ,
- , ,
Strong positive correlation: more study hours associate with higher scores.
Coefficient of Determination ()
For :
Interpretation: 50% of variation in exam scores is "explained" by study hours.
The remaining 50% is due to other factors.
Testing Significance
Is the correlation significantly different from zero?
With
For , :
P-value (not significant at )
With only 5 points, even moderate correlation may not be significant.
Use correlation p-value calculator for precise values.
Sample Size and Significance
| Sample Size | r needed for p < 0.05 |
|---|---|
| 10 | 0.63 |
| 20 | 0.44 |
| 30 | 0.36 |
| 50 | 0.28 |
| 100 | 0.20 |
| 500 | 0.09 |
Small correlations become significant with large samples. Always report alongside p-value.
Correlation β Causation
Critical warning: Correlation does not imply causation.
Possible explanations for correlation:
- X causes Y
- Y causes X
- Third variable causes both
- Coincidence
Example: Ice cream sales and drowning deaths are correlated. Reality: Hot weather causes both. Ice cream doesn't cause drowning.
When Pearson Correlation Fails
Non-Linear Relationships
A perfect parabolic relationship may have .
Always plot your data first!
Outliers
Single extreme points can dramatically change .
Outliers may inflate or mask true correlation.
Restricted Range
If X has limited variability, correlation is attenuated.
Studying only honors students may hide the full correlation between study time and grades.
Heteroscedasticity
If Y's spread changes across X values, Pearson may be misleading.
Assumptions
Linearity
The relationship between X and Y is linear.
Check with scatterplot.
Continuous Variables
Both X and Y are measured on interval or ratio scales.
For ordinal data, use Spearman correlation.
Bivariate Normality
For significance testing, the joint distribution should be approximately normal.
No Significant Outliers
Outliers disproportionately influence .
Homoscedasticity
The variance of Y is constant across levels of X.
Applications
Research and Science
Testing hypothesized relationships between variables.
"Is there evidence of a relationship between exposure and outcome?"
Finance
Measuring how assets move together.
Portfolio diversification relies on low or negative correlations.
Quality Control
Relating process parameters to output quality.
"How strongly does temperature affect product strength?"
Psychology
Validating measurement instruments.
Test-retest reliability, convergent validity.
Medicine
Relating biomarkers to outcomes.
"How well does this marker predict disease severity?"
Correlation Matrix
For multiple variables, compute all pairwise correlations:
| Xβ | Xβ | Xβ | |
|---|---|---|---|
| Xβ | 1.00 | 0.72 | -0.35 |
| Xβ | 0.72 | 1.00 | -0.18 |
| Xβ | -0.35 | -0.18 | 1.00 |
Matrix is symmetric; diagonal is always 1.
Partial Correlation
Control for a third variable:
= correlation between X and Y, holding Z constant.
Reveals whether X-Y relationship persists after accounting for Z.
Confidence Interval for r
Use Fisher's z-transformation:
of
Calculate CI in z-space, then transform back.
Comparing Correlations
To test if two correlations differ:
Convert both to (Fisher transformation)
Reporting Results
APA format:
"There was a strong positive correlation between study hours and exam scores, r(3) = .71, p = .18. However, with only 5 participants, this correlation did not reach statistical significance."
For significant results:
"Hours of sleep was significantly correlated with reaction time, r(98) = -.45, p < .001, indicating that less sleep was associated with slower responses."
Historical Context
Karl Pearson developed this correlation coefficient in the 1890s, building on earlier work by Francis Galton.
Galton first used the concept of correlation to study heredityβhow parent and offspring characteristics relate.
Pearson formalized the mathematics and gave us the formula still used today. His work established correlation as a fundamental tool for understanding relationships between variables.
Common Mistakes
Confusing Correlation with Causation
The most common error. Always consider alternative explanations.
Ignoring Non-Linearity
A scatterplot reveals patterns that misses.
Over-Interpreting Small Correlations
With large , trivially small can be "significant."
Reporting as
is not the same as .
Related Calculations
- Spearman Correlation β Rank-based correlation
- Correlation P-Value β Significance test
- R-Squared Calculator β Coefficient of determination
- Linear Regression β Predict Y from X
- Scatterplot Interpretation β Visual analysis
Summary
Pearson correlation coefficient () measures the linear relationship between two continuous variables, ranging from -1 (perfect negative) to +1 (perfect positive). Calculate using the formula involving cross-products of deviations, then test significance using a t-test with . Always visualize data with a scatterplot firstβ only captures linear relationships. Report both and p-value, recognize that correlation does not imply causation, and be cautious with outliers. For ordinal data or non-linear monotonic relationships, use Spearman correlation instead.