Correlation Calculator
Calculate the Pearson correlation coefficient (r), coefficient of determination (r²), and test significance from summary statistics.
About this calculator
This calculator computes the Pearson correlation coefficient r and its significance test purely from six summary sums — Number of Data Points (n), Σxy, Σx, Σy, Σx², and Σy² — rather than raw paired data, using r = (nΣxy − ΣxΣy) / √(|nΣx²−(Σx)²| × |nΣy²−(Σy)²|) (lines 12-17). Degrees of Freedom is the simplest output here: it's exactly n − 2 (line 21) and is completely unaffected by any of the five sum inputs — only Number of Data Points moves it. T-Statistic responds far more strongly to Σx than to any other input at the calculator's defaults, since Σx feeds directly into both the numerator and one of the two denominator terms of r, and the resulting t-statistic is itself a steep function of r near the calculator's default correlation strength.
The P-Value calculation branches on an exact condition — Degrees of Freedom at least 30 uses the plain normal approximation, otherwise a small-sample adjustment (adjustedZ = |t| × √(df/(df+1))) is applied first (lines 30-35) — and at the default 10 data points (df = 8), every calculation runs through that small-sample branch, which a reader wouldn't see unless Number of Data Points is set to 32 or more. Number of Data Points is never rounded to a whole number anywhere in this engine, despite conceptually representing a count of paired observations — a fractional value like 10.5 is used exactly as typed throughout every formula. This calculator does not compute a correlation from a raw list of (x, y) pairs — you have to supply the six sums yourself, so any arithmetic mistake in deriving those sums from your original data will silently produce a wrong but plausible-looking r.
Inputs
Results
Correlation Coefficient (r)
0.47
R-Squared (r²)
0.22
How to Use This Calculator
- Enter Number of Data Points (n), Sum of XY (Σxy), and Sum of X (Σx).
- Set Sum of Y (Σy), Sum of X² (Σx²), and Sum of Y² (Σy²).
- Review Correlation Coefficient (r) and R-Squared (r²).
- Use T-Statistic and P-Value (two-tailed, approx) to inform your decision.
- Use the chart to visualize the results and explore different scenarios by adjusting inputs.
How the result changes with Sum of XY (Σxy)
| Sum of XY (Σxy) | Correlation Coefficient (r) | R-Squared (r²) |
|---|---|---|
| 1,925 | -3.65 | 13.35 |
| 2,888 | -1.59 | 2.53 |
| 5,775 | 4.6 | 21.13 |
| 9,625 | 12.85 | 165.01 |
What each input means
- Number of Data Points (n)
- Total number of paired observations. Must be at least 3.
- Sum of XY (Σxy)
- Sum of the products of each paired x and y value.
- Sum of X (Σx)
- Sum of all x values in the data set.
- Sum of Y (Σy)
- Sum of all y values in the data set.
- Sum of X² (Σx²)
- Sum of each x value squared.
- Sum of Y² (Σy²)
- Sum of each y value squared.
How this is calculated
Worked example, using the default values
- Identify Input Parameters4 parametersNumber of Data Points (n) = 10, Sum of XY (Σxy) = 3850, Sum of X (Σx) = 55, Sum of Y (Σy) = 660 = 6 input(s) provided
- Calculate Correlation CoefficientCorrelation Coefficient0.4714 = 0.4714
- Calculate R-SquaredR-Squared0.2222 = 0.2222
- Calculate T-StatisticT-Statistic1.5119 = 1.5119
- Calculate P-ValueP-Value0.154 = 0.154
Engine last updated . Checked against 3 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
Does Σy or Σy² affect the Degrees of Freedom shown?
No — Degrees of Freedom is exactly Number of Data Points minus 2 (line 21) and reads nothing else; none of the five sum inputs (Σxy, Σx, Σy, Σx², Σy²) has any effect on it at all.
When does the P-Value calculation switch to the small-sample adjustment?
Whenever Degrees of Freedom is below 30, meaning Number of Data Points is under 32 (line 30) — which includes the calculator's own default of 10 data points. Below that threshold, the T-Statistic is first scaled by the square root of df / (df + 1) (line 33) before being converted to a P-Value; at 32 or more data points, that adjustment is skipped entirely.
Can I enter a fractional value like 10.5 for Number of Data Points?
The engine will accept it and use it exactly as typed in every formula (line 4) — there's no rounding to a whole number anywhere in this calculator, even though Number of Data Points conceptually represents a count of paired observations.
Do I need my raw x and y data pairs to use this calculator?
No, but you do need to have already computed six summary sums from them yourself — Σxy, Σx, Σy, Σx², Σy², and the count n — since the engine only ever operates on those six numbers (lines 4-9) and has no way to check whether they were derived correctly from an underlying dataset.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Multiple Regression Calculator
Evaluate a multiple regression model using SSR, SSE, number of predictors, and sample size. Calculate R², adjusted R², F-statistic, and model fit metrics.
StatisticsLogistic Regression Calculator
Calculate the predicted probability, odds, and odds ratio from logistic regression coefficients. Visualize the S-shaped probability curve.
StatisticsZ-Score Calculator
Calculate the z-score (standard score) for any value in a normal distribution. Find the percentile ranking and probability associated with your data point.
More in Math & Statistics.