Relationship between two numeric variables
Correlation calculator
How results are checked
Named statistical review pending. Selected automated reference cases are published on the validation page.Result on the sample data
.78r
Customers who rate value for money higher are more satisfied (p < .001)
r² = .62 · Spearman ρ = .78 · Kendall τ-b = .60 · n = 60
Pearson r, 95% CI
A correlation coefficient measures how closely two numeric variables move together, from −1 (perfectly opposite) through 0 (no relationship) to +1. Pearson's r measures straight-line association; Spearman's ρ and Kendall's τ-b use ranks, so they capture any consistently increasing or decreasing pattern and resist outliers. Report r with its confidence interval — and look at the scatter plot, because a single number can hide curves, clusters and outliers.
Run this on your own data — free, no signup
Upload a CSV, Excel, SPSS, Stata, SAS, R, Parquet or JSON file. Everything runs in your browser; your file never leaves your device.
Open the workspace →Calculate online
Paste two columns (x and y) from a spreadsheet or open a data file — it is read in your browser and never uploaded — to get all three coefficients and a scatter plot with a data table. If you only have a published r, enter r and n; to test whether two groups have different correlations, use the comparison tab.
Paste two columns from a spreadsheet; a header row names the variables. Rows with a missing value in either column are dropped.
Pearson correlation
r(58) = 0.784
A very strong positive linear relationship (95% CI [0.662, 0.866]); x and y share r² = 0.615 of their variance. Statistically significant at α = .05.
p < .001 · n = 60
Correlation coefficients
| Coefficient | Estimate | p (two-sided) | 95% CI |
|---|---|---|---|
| Pearson r | 0.784 | p < .001 | [0.662, 0.866] |
| r² | 0.615 | ||
| t test of r (df = 58) | t = 9.630 | p < .001 | |
| Spearman ρ | 0.777 | p < .001 | |
| Kendall τ-b | 0.599 | p < .001 |
Scatter plot
Show the plotted data as a table
| Row | Value for money (0–10) | Overall satisfaction (0–100) |
|---|---|---|
| 1 | 4.3 | 51 |
| 2 | 5.3 | 52 |
| 3 | 7.3 | 82 |
| 4 | 6.9 | 68 |
| 5 | 2.8 | 43 |
| 6 | 5.3 | 65 |
| 7 | 5.2 | 47 |
| 8 | 3.5 | 60 |
| 9 | 6.4 | 68 |
| 10 | 4.3 | 50 |
| 11 | 8.7 | 77 |
| 12 | 7 | 63 |
| 13 | 6.4 | 50 |
| 14 | 5.8 | 62 |
| 15 | 5.8 | 59 |
| 16 | 7.7 | 74 |
| 17 | 5.8 | 78 |
| 18 | 3.3 | 47 |
| 19 | 6.2 | 66 |
| 20 | 4.8 | 67 |
| 21 | 7.1 | 67 |
| 22 | 8.3 | 83 |
| 23 | 4.3 | 68 |
| 24 | 9.2 | 76 |
| 25 | 5.7 | 71 |
| 26 | 2.2 | 31 |
| 27 | 4.9 | 63 |
| 28 | 3.5 | 40 |
| 29 | 3.2 | 58 |
| 30 | 4 | 51 |
| 31 | 6.6 | 71 |
| 32 | 6.1 | 67 |
| 33 | 7.8 | 82 |
| 34 | 1.9 | 53 |
| 35 | 4.9 | 54 |
| 36 | 4 | 58 |
| 37 | 4.9 | 61 |
| 38 | 5.4 | 70 |
| 39 | 6.4 | 65 |
| 40 | 6 | 71 |
| 41 | 2.5 | 48 |
| 42 | 5.9 | 64 |
| 43 | 4.9 | 58 |
| 44 | 7 | 69 |
| 45 | 7.7 | 73 |
| 46 | 7.2 | 70 |
| 47 | 4.9 | 74 |
| 48 | 6.5 | 72 |
| 49 | 4.9 | 54 |
| 50 | 6.9 | 63 |
| 51 | 3.8 | 64 |
| 52 | 5 | 68 |
| 53 | 8.4 | 100 |
| 54 | 7.8 | 79 |
| 55 | 7.3 | 79 |
| 56 | 7.1 | 93 |
| 57 | 5.6 | 62 |
| 58 | 5 | 52 |
| 59 | 9.9 | 94 |
| 60 | 6.9 | 59 |
Pearson, Spearman or Kendall?
Use Pearson's r for two roughly continuous variables with a linear relationship and no extreme outliers; r² is then the share of variance the two variables share. Use Spearman's ρ when the relationship is monotonic but curved, when the data are ranks or short rating scales, or when outliers would dominate r. Kendall's τ-b (with a tie correction) is the more conservative rank measure and is better behaved in small samples with many ties; its values are typically smaller than ρ for the same data.
For two ordinal variables already tabulated into a crosstab, the Kendall's tau calculator works directly on the table and adds tau-c for rectangular tables.
The method
Formula
r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √[Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)²]
where
- t = r√(n − 2) / √(1 − r²)
- the test of ρ = 0, with n − 2 degrees of freedom
- Fisher z
- z = atanh(r) has standard error 1/√(n − 3); the interval tanh(z ± z₀.₉₇₅/√(n − 3)) is the confidence interval for ρ
- Spearman ρ
- Pearson's r computed on the ranks of x and y (average ranks for ties)
- Kendall τ-b
- (C − D) / √[(n₀ − n₁)(n₀ − n₂)] — concordant minus discordant pairs, corrected for ties
- two correlations
- z = (atanh r₁ − atanh r₂) / √(1/(n₁ − 3) + 1/(n₂ − 3)), for independent samples
Worked example
The sample data is synthetic: 60 customers rated value for money (0–10) and overall satisfaction (0–100). Pearson's r = .784, t(58) = 9.63, p < .001, with 95% CI [.66, .87]. The two ratings share r² = .62 of their variance.
The rank coefficients tell the same story — Spearman's ρ = .78 and Kendall's τ-b = .60 (both p < .001) — so the result is not driven by a few extreme points.
In a second synthetic group of 70 returning customers the correlation is weaker, r = .34. Fisher's test of the difference gives z = 3.87, p < .001: value for money is more closely tied to satisfaction among new customers.
Using it well
When to use it
Use it when
- Use: Two numeric measurements on the same respondents (ratings, scores, spend, time).
- Use: Describing the strength and direction of a relationship before modelling it.
- Use: Checking whether a relationship differs between two independent segments.
- Use: Rank coefficients: ordinal scales, skewed data or outliers.
Not the right tool when
- Avoid: Inferring causation — correlated variables may share a cause, or the direction may run the other way.
- Avoid: Curved (non-monotonic) relationships — r can be near 0 even when y depends strongly on x.
- Avoid: Two categorical variables — use Cramér's V or another association measure for crosstabs.
- Avoid: Correlations from the same sample that share a variable — they are dependent, and Fisher's two-sample test does not apply.
How to interpret it
Rule of thumb
The sign gives the direction and the size the strength: by Cohen's rough convention |r| around .1 is small, .3 medium and .5 large, but what matters depends on the field. The p-value tests only whether ρ = 0 — with large samples tiny correlations become significant — so read the confidence interval for the plausible range of the true correlation. r² is the proportion of variance in one variable linearly associated with the other.
Questions
Frequently asked questions
What is a good correlation coefficient?
There is no universal threshold. Cohen suggested |r| ≈ .1 small, .3 medium and .5 large for behavioural research, but in survey work two ratings of the same experience often correlate above .5, while a correlation of .2 between an attitude and later behaviour can be meaningful. Judge it against the confidence interval and comparable studies.
How is the confidence interval for r calculated?
With Fisher's z transformation: z = atanh(r) is approximately normal with standard error 1/√(n − 3). The calculator builds the interval on the z scale and transforms the limits back with tanh, so the interval is asymmetric around r and stays inside −1 to 1.
Should I use Pearson or Spearman correlation?
Use Pearson for roughly linear relationships between continuous variables without extreme outliers. Use Spearman (or Kendall) for ranks, short ordinal scales, skewed data, outliers or curved but monotonic relationships. If both give similar values, report Pearson; if they differ, look at the scatter plot to see why.
How do I test whether two correlations are different?
For correlations from two independent groups, transform each with Fisher's z and compare: z = (atanh r₁ − atanh r₂) / √(1/(n₁ − 3) + 1/(n₂ − 3)). The comparison tab does this and also gives Zou's (2007) confidence interval for the difference. Correlations from the same sample need a dependent-correlation test instead.
What does r squared mean?
r² is the share of the variance in one variable that is linearly associated with the other — for example r = .5 means r² = .25, or 25% shared variance. It is also the R² of a simple linear regression of y on x.
Sources and next steps
References & further reading
- [1]Fisher, R. A. (1915). Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population. Biometrika, 10(4), 507–521.
- [2]Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72–101.
- [3]Kendall, M. G. (1938). A new measure of rank correlation. Biometrika, 30(1–2), 81–93.
- [4]Zou, G. Y. (2007). Toward using confidence intervals to compare correlations. Psychological Methods, 12(4), 399–413.
- [5]SciPy — scipy.stats.pearsonrdocs.scipy.org
Try it on your own data — free, no signup
Upload a CSV, Excel, SPSS, Stata, SAS, R, Parquet or JSON file. Everything runs in your browser; your file never leaves your device.
Open the workspace →