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.
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
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
Residuals
| x | y | predicted | residual |
|---|---|---|---|
| 10 | 8.04 | 8.001 | 0.039 |
| 8 | 6.95 | 7.00082 | -0.05082 |
| 13 | 7.58 | 9.50127 | -1.921 |
| 9 | 8.81 | 7.50091 | 1.309 |
| 11 | 8.33 | 8.50109 | -0.1711 |
| 14 | 9.96 | 10.0014 | -0.04136 |
| 6 | 7.24 | 6.00064 | 1.239 |
| 4 | 4.26 | 5.00045 | -0.7405 |
| 12 | 10.84 | 9.00118 | 1.839 |
| 7 | 4.82 | 6.50073 | -1.681 |
| 5 | 5.68 | 5.50055 | 0.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
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.
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.
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.
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
Descriptive Statistics
Computes mean, median, mode, variance, standard deviation, quartiles and outliers from pasted numbers.
Equation Solver
Solves linear, quadratic and cubic equations with the working shown, finds real roots of other equations numerically, and solves linear systems by elimination.
A/B Test Calculator
Runs a two-proportion z-test and a chi-square test on two conversion rates with Wilson confidence intervals, and computes the sample size for a target effect and power.
Unit Converter
Converts length, weight, area, volume, temperature, speed, pressure and data units, including Korean units.
Next
These accept what this tool produces, so the result can go straight in.
Quick Chart
Draws a bar, line, area, pie or scatter chart from a table with round-number axes and a legend, and exports it as SVG or PNG.
Column Statistics
Profiles each column with count, nulls, unique values, min, max, mean, median and distribution.
Descriptive Statistics
Computes mean, median, mode, variance, standard deviation, quartiles and outliers from pasted numbers.
Currency Converter
Converts between about thirty currencies at the ECB’s daily reference rates, crossed through the euro, or at a rate you type in.
Date Difference
Counts days, weeks, months and years between two dates, with a D-day view and business-day option.
Percentage Calculator
Works out percentage of, percentage change, discount, markup and reverse percentage in one place.