Skip to content

Regression & Correlation

Fits a linear, polynomial, exponential, logarithmic or power model to paired data and reports R², Pearson r, Spearman ρ and residuals.

Fits a line or a curve to paired numbers and reports how well it fits: R², Pearson r, Spearman ρ and the residual for every point. It fits linear, polynomial, exponential, logarithmic and power models, and it will tell you when a model had to leave points out.

🔒 Runs entirely in your browserregressionstatisticsfitmath

Data

11 points

One x, y pair per line. Comma, tab or space all separate the two columns, and a comma that is grouping digits — 1,234 — stays inside its number. A first line of names is skipped.

Take two columns from a CSV

Drop a CSV

Read in this tab. Nothing is uploaded. Files from Korean, Japanese, Chinese and Western Excel (CP949, Shift_JIS, GBK, Windows-1252) are recognised.

Model

Kind

y = a + bx. The ordinary trend line.

Result

y = 0.500091x + 3.00009

R² (coefficient of determination)

0.6665

Closer to 1, more of the variation explained

r (Pearson)

0.8164

Direction and strength of a straight-line relationship

ρ (Spearman)

0.8182

Monotone relationship, judged on ranks

RMSE

1.119

Root mean square of the residuals

n

11

Standard error of the slope

0.1179

Standard error of the intercept

1.125

y ≈ 10.5015

Scatter and fitted curve

4681012468101214

Residuals

xypredictedresidual
108.048.0010.039
86.957.00082-0.05082
137.589.50127-1.921
98.817.500911.309
118.338.50109-0.1711
149.9610.0014-0.04136
67.246.000641.239
44.265.00045-0.7405
1210.849.001181.839
74.826.50073-1.681
55.685.500550.1795

Polynomial fits shift x into [-1, 1] and solve by Householder QR rather than by the normal equations, which lose every significant digit when a cubic is fitted to years. Exponential, logarithmic and power fits are straight lines in transformed variables, and R² is computed against the original y so that a curve which only fits well in log space does not look good here.

The starting data is the first of Anscombe’s quartet — slope 0.5, intercept 3, r 0.816.

How to use it

  1. Paste x and y pairs

    One pair per line, separated by a comma, a tab or a space. On this page a comma between the two columns is a separator and a comma inside 1,234 is grouping digits, and the shape of the digits says which. On the pages whose language marks the decimal with a comma — Spanish, Portuguese, German, French, Italian — the comma is only ever the decimal, and the two columns are separated by a tab, a semicolon or a space instead. Or drop a CSV and pick two columns.

  2. Choose a model

    Linear unless you have a reason. Exponential for something growing at a constant rate, logarithmic for something that rises then flattens. Polynomial degree above three is nearly always the wrong answer.

  3. Read the residuals, not only R²

    A high R² with residuals that curve means the model is the wrong shape. The scatter plot with the fitted line shows this in a second, which is what R² alone never does.

  4. Predict a value

    Type an x and read the y off the fitted model. Outside the range of your data this is extrapolation, which the fit has no opinion about and no evidence for.

Common questions

What is the difference between r and ρ?

Pearson r measures a straight-line relationship; Spearman ρ measures whether one goes up as the other does, on ranks, whatever the shape. A perfect curve has ρ = 1 and an r well below it, which is the signal that a straight line is the wrong model.

Why did some points get left out?

Exponential fitting takes the logarithm of y and logarithmic fitting takes the logarithm of x, and the logarithm of a non-positive number does not exist. The page says how many points went and why.

Does a high R² mean one causes the other?

No. The default data here is Anscombe’s first set precisely because his four sets share a slope, an intercept and an r of 0.816 while looking nothing like each other. Plot before you conclude.

Is the polynomial fit numerically safe?

It shifts x into the range −1 to 1 and solves by Householder QR rather than through the normal equations, which lose every significant digit when a cubic is fitted to years like 2019 and 2020.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.