Calculate Pearson r or Spearman rho between two variables. Results include scatter plot, p-value, and APA-formatted output.
Correlation is a statistical measure that quantifies the strength and direction of the relationship between two variables. The correlation coefficient ranges from -1 (perfect negative relationship) to +1 (perfect positive relationship), with 0 indicating no linear relationship. Correlation analysis is one of the most widely used techniques in psychology, education, medicine, economics, and the social sciences.
The concept of correlation was pioneered by Sir Francis Galton in the 1880s during his studies of heredity and regression toward the mean. His work was formalized by Karl Pearson, who developed the product-moment correlation coefficient (Pearson's r) in 1896, providing the mathematical foundation still used today. In 1904, Charles Spearman introduced the rank-order correlation coefficient (Spearman's rho), a non-parametric alternative designed for ordinal data and monotonic relationships. Together, these two measures form the backbone of modern bivariate correlation analysis.
Pearson's r measures the strength of the linear relationship between two continuous variables. It is calculated as the covariance of the two variables divided by the product of their standard deviations. Use Pearson when both variables are measured on interval or ratio scales, the relationship is approximately linear, and the data are roughly normally distributed.
Spearman's rho (rs) is a non-parametric measure that assesses the monotonic relationship between two variables using their ranks rather than raw values. Use Spearman when data are ordinal (e.g., Likert scales), when the relationship is monotonic but not necessarily linear, or when outliers are a concern. Because it operates on ranks, Spearman's rho is more robust to extreme values than Pearson's r.
A psychology professor collects data from 10 students to examine whether weekly study hours predict exam performance. Each student reports their average weekly study hours, and their final exam score (out of 100) is recorded.
Study Hours (X)
2, 4, 6, 8, 10, 12, 14, 16, 18, 20
M = 11.00, SD = 6.06
Exam Score (Y)
52, 58, 61, 68, 72, 78, 81, 85, 90, 95
M = 74.00, SD = 14.23
Scatter Plot Description
Plotting these 10 data points reveals a clear upward trend: as study hours increase from 2 to 20, exam scores rise from 52 to 95. The points cluster tightly around an upward-sloping regression line, indicating a strong positive linear relationship with minimal scatter.
Results
r(8) = .87, p < .001, 95% CI [.53, .97]
There is a strong positive correlation between weekly study hours and exam scores. Students who studied more hours per week tended to score substantially higher on the final exam. The coefficient of determination (r2 = .76) indicates that study hours account for approximately 76% of the variance in exam scores.
Choosing the correct correlation method depends on your data type, distribution, and the nature of the relationship you expect. Here is a side-by-side comparison to guide your decision:
| Feature | Pearson r | Spearman rs |
|---|---|---|
| Type | Parametric | Non-parametric |
| Data level | Interval / Ratio | Ordinal / Interval / Ratio |
| Relationship detected | Linear only | Any monotonic relationship |
| Normality required | Yes (bivariate normality) | No |
| Sensitive to outliers | Yes, highly | More robust |
| Best for | Continuous, normally distributed data | Ranked data, non-normal distributions, ordinal scales |
| Example use case | Height vs. weight | Customer satisfaction (1-5) vs. purchase frequency |
The absolute value of the correlation coefficient indicates the strength of the relationship. While context matters and different fields have different norms, the following guidelines (based on Evans, 1996) provide a general framework:
| |r| Value | Strength | Interpretation |
|---|---|---|
| .00 – .19 | Very Weak | Negligible relationship; practically no predictive value |
| .20 – .39 | Weak | Small but potentially meaningful relationship |
| .40 – .59 | Moderate | Noticeable relationship with meaningful predictive power |
| .60 – .79 | Strong | Substantial relationship; good predictive accuracy |
| .80 – 1.00 | Very Strong | Near-perfect relationship; excellent predictive accuracy |
Note: These thresholds apply equally to positive and negative correlations. An r = -.85 is just as strong as r = +.85; only the direction differs.
Before interpreting your correlation results, verify that these assumptions are met:
1. Linearity
Pearson's r assumes a linear relationship between the two variables. Always inspect a scatter plot first. If the relationship is curved (e.g., U-shaped or logarithmic), Pearson's r will underestimate the true strength of the association. In such cases, consider Spearman's rho or a non-linear transformation.
2. Bivariate Normality (Pearson only)
Pearson's r assumes that both variables are approximately normally distributed. This assumption is important primarily for significance testing and confidence intervals. With sample sizes above 30, the test is reasonably robust to moderate violations. For non-normal data, use Spearman's rho instead.
3. Continuous Data
Both variables should be measured on a continuous scale (interval or ratio) for Pearson's r. If either variable is ordinal (e.g., Likert-type ratings, class rank), use Spearman's rho, which operates on ranks and does not require continuous measurement.
4. No Significant Outliers
Outliers can dramatically inflate or deflate Pearson's r. A single extreme data point can shift the correlation from near zero to strong (or vice versa). Always visualize your data with a scatter plot to identify outliers. If outliers are present, consider removing them with justification or switching to Spearman's rho.
One of the most important principles in statistics is that correlation does not equal causation. A strong correlation between two variables means they tend to move together, but it does not prove that one variable causes the other to change.
There are three possible explanations for any observed correlation:
Classic example: Ice cream sales and drowning deaths are strongly positively correlated. Does ice cream cause drowning? Of course not. The confounding variable is temperature -- hot weather increases both ice cream consumption and swimming activity, leading to more drownings. Without controlling for temperature, you would incorrectly conclude a causal link between ice cream and drowning.
To establish causation, you need a well-designed experimental study with random assignment, or use advanced techniques like instrumental variables, regression discontinuity, or difference-in-differences.
According to APA 7th edition guidelines, correlation results should include the correlation coefficient, degrees of freedom (N - 2), the p-value, and ideally the 95% confidence interval. Here are templates with actual numbers you can adapt:
Pearson Correlation
A Pearson correlation was computed to assess the relationship between weekly study hours and exam scores. There was a strong positive correlation between the two variables, r(8) = .87, p < .001, 95% CI [.53, .97]. Students who spent more hours studying per week tended to achieve higher exam scores.
Spearman Correlation
A Spearman rank-order correlation was computed to assess the relationship between customer satisfaction ratings and repurchase frequency. There was a moderate positive correlation, rs(48) = .52, p < .001. Customers who reported higher satisfaction levels tended to repurchase more frequently.
Note: Report correlation coefficients to two decimal places without a leading zero (e.g., .87 not 0.87). Report p-values to three decimal places, except use p < .001 when the value is below .001. Degrees of freedom for correlation are N - 2.
StatMate's correlation calculations have been validated against R's cor.test() function. We compute Pearson's r using the standard product-moment formula and Spearman's rho using ranked values. Significance testing uses the t-distribution with N - 2 degrees of freedom. The 95% confidence interval for Pearson's r is computed via Fisher's z-transformation. All results match R output to at least 4 decimal places.
T-Test
Compare means between two groups
ANOVA
Compare means across 3+ groups
Chi-Square
Test categorical associations
Descriptive
Summarize your data
Sample Size
Power analysis & sample planning
One-Sample T
Test against a known value
Mann-Whitney U
Non-parametric group comparison
Wilcoxon
Non-parametric paired test
Regression
Model X-Y relationships
Multiple Regression
Multiple predictors
Cronbach's Alpha
Scale reliability
Logistic Regression
Binary outcome prediction
Factor Analysis
Explore latent factor structure
Kruskal-Wallis
Non-parametric 3+ group comparison
Repeated Measures
Within-subjects ANOVA
Two-Way ANOVA
Factorial design analysis
Friedman Test
Non-parametric repeated measures
Fisher's Exact
Exact test for 2×2 tables
McNemar Test
Paired nominal data test
Paste from Excel/Sheets or drop a CSV file
Paste from Excel/Sheets or drop a CSV file
Enter your data and click Calculate
or click "Load Example" to try it out