Statistics & probability

Pearson correlation test

Test and measure the straight-line relationship between two variables, with a confidence interval and regression line.

Pearson correlation test
Esc to restore

Your inputs

Correlation does not show cause, and one outlier can change r a great deal. Plot your data first.

Separate x and y with a comma, space, tab or semicolon. A non-numeric first line is treated as a heading. 3 to 10,000 pairs.

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Pearson’s r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² Σ(y − ȳ)²). The test statistic t = r √((n − 2) ÷ (1 − r²)) follows a Student t distribution with n − 2 degrees of freedom when the true correlation is zero, which gives the exact p-value. The confidence interval applies the Fisher z transformation: z = atanh(r) with standard error 1 ÷ √(n − 3), then converts the limits back with tanh. The least-squares line has slope Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)². Assumes independent pairs from roughly bivariate-normal data.

How this is checked

4 reference checks passed These 4 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.

See the checks and where each expected answer comes from
  1. Case 1

    Inputs
    Paired values, one “x y” pair per line 44.4 2.6 45.9 3.1 41.9 2.5 53.3 5.0 44.7 3.6 44.1 4.0 50.7 5.2 45.2 2.8 60.1 3.8
    Expected, and what Toolmoz gave
    Pearson r expected 0.5711816, Toolmoz 0.5711815575638288t statistic expected 1.841083, Toolmoz 1.8410826381153387P-value (two-sided) expected 0.108173, Toolmoz 0.1081730543494938495% confidence interval for r, lower limit expected -0.1497426, Toolmoz -0.1497426330367519595% confidence interval for r, upper limit expected 0.8955795, Toolmoz 0.8955794618387383
    Where the expected answer comes from
    R documentation example for cor.test (Hollander and Wolfe): cor 0.5711816, t = 1.8411, df = 7, p = 0.1082, 95% CI −0.1497426 to 0.8955795; t density integrated separately for the p-value
    Allowed difference
    ±0.000002 absolute
  2. Case 2

    Inputs
    Paired values, one “x y” pair per line 10 8.04 8 6.95 13 7.58 9 8.81 11 8.33 14 9.96 6 7.24 4 4.26 12 10.84 7 4.82 5 5.68
    Expected, and what Toolmoz gave
    Pearson r expected 0.81642052, Toolmoz 0.81642051634484t statistic expected 4.241455, Toolmoz 4.241455288892834P-value (two-sided) expected 0.0021696, Toolmoz 0.0021696288730787823Least-squares slope (y on x) expected 0.50009091, Toolmoz 0.5000909090909091Least-squares intercept expected 3.00009091, Toolmoz 3.0000909090909103
    Where the expected answer comes from
    Anscombe’s quartet, set I: r = 0.816, y = 3.00 + 0.500x, with the exact values computed separately from the sums of squares and the t density
    Allowed difference
    ±0.000005 absolute
  3. Case 3

    Inputs
    Paired values, one “x y” pair per line 1 3 2 5 3 7 4 9 5 11
    Expected, and what Toolmoz gave
    Pearson r expected 1, Toolmoz 1Least-squares slope (y on x) expected 2, Toolmoz 2Least-squares intercept expected 1, Toolmoz 1
    Where the expected answer comes from
    y = 2x + 1 lies exactly on a line, so r = 1, slope 2 and intercept 1
    Allowed difference
    ±1e-12 absolute
  4. Case 4

    Inputs
    Paired values, one “x y” pair per line 1 10 2 8 3 6 4 4
    Expected, and what Toolmoz gave
    Pearson r expected -1, Toolmoz -1Least-squares slope (y on x) expected -2, Toolmoz -2Least-squares intercept expected 12, Toolmoz 12
    Where the expected answer comes from
    y = 12 − 2x lies exactly on a line, so r = −1
    Allowed difference
    ±1e-12 absolute

What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Paired values, one “x y” pair per line
44.4 2.6
45.9 3.1
41.9 2.5
53.3 5.0
44.7 3.6
44.1 4.0
50.7 5.2
45.2 2.8
60.1 3.8
Alternative
Correlation is not zero (two-sided)
Confidence level
95%

Example result

Pairs (n)
9
Pearson r
0.5712
r² (shared variance)
0.3262
Degrees of freedom
7
t statistic
1.8411
P-value (two-sided)
0.108173
95% confidence interval for r, lower limit
-0.1497
95% confidence interval for r, upper limit
0.8956
Least-squares slope (y on x)
0.0972
Least-squares intercept
-1.0241

The interval uses the Fisher z transformation. Pearson’s r measures a straight-line relationship only (strong here, by a common rule of thumb): outliers, curves and clusters can mislead, and correlation does not show cause. The test assumes pairs are independent and roughly bivariate normal.