How to use it
Paste your paired data one observation per line, with x and y separated by a comma, tab or space. Two columns copied straight from a spreadsheet paste correctly. Lines that do not contain two parseable numbers are skipped and counted.
Set a prediction value to get a fitted y for any x. The residual table underneath shows every observation, its fitted value and the gap between them — which is where you look when the R² is good but the model is still wrong.
What least squares does
Ordinary least squares finds the single straight line that minimises the sum of squared vertical distances between the observed points and the line. Squaring means large misses count disproportionately, and it makes the solution unique and computable in closed form — no iteration required.
The intercept formula guarantees the line passes through the point (x̄, ȳ) — the centroid of the data. That is always true of a least squares fit and is a useful sanity check.
Reading the output
Slope
The slope is the practical result: the average change in y associated with a one-unit increase in x. It carries the units of y per unit of x, and it is the number to quote when describing what the model found. A slope of 2.01 on data measured in kilograms per year means roughly two kilograms gained per year.
Intercept
The fitted value of y when x = 0. Frequently meaningless, and that is fine. If x is a person's height in centimetres, the intercept describes a person of zero height. It exists to position the line correctly, not to be interpreted. Only read it substantively when x = 0 falls inside your observed range and is a physically sensible value.
Correlation coefficient, r
A number between −1 and +1 measuring the strength and direction of the linear association. Its sign always matches the slope's. Conventional bands:
| |r| | Strength | R² | Variance explained |
|---|---|---|---|
| 0.90 – 1.00 | Very strong | 0.81 – 1.00 | 81% or more |
| 0.70 – 0.89 | Strong | 0.49 – 0.80 | 49% to 80% |
| 0.50 – 0.69 | Moderate | 0.25 – 0.48 | 25% to 48% |
| 0.30 – 0.49 | Weak | 0.09 – 0.24 | 9% to 24% |
| 0.00 – 0.29 | Negligible | 0.00 – 0.08 | Under 9% |
These bands are conventions, not thresholds. In physics an r of 0.95 might indicate a problem with the apparatus; in social science 0.4 can be a substantial finding. Judge against what is normal in your field.
R²
The coefficient of determination — simply r squared for a single-predictor model. It is the proportion of variance in y accounted for by x. An R² of 0.94 means 94% of the variation in y is explained by the linear relationship and 6% is not.
Standard error of the estimate
The typical size of a residual — roughly how far a prediction is likely to be off, in the units of y. It is the standard deviation of the residuals, adjusted for the two parameters the model spent.
Standard error of the slope and the t statistic
The slope is itself an estimate from a sample, so it has its own uncertainty. Dividing the slope by its standard error gives a t statistic testing the null hypothesis that the true slope is zero — that x and y are unrelated. As a rough guide, |t| above about 2 with a reasonable sample size indicates a slope distinguishable from zero at the 5% level. For an exact p-value you need the t-distribution with n − 2 degrees of freedom.
A worked example
The default data set is ten points that rise almost linearly. Working the key quantities:
- x̄ = 5.5, ȳ = 11.14
- Sxx = Σ(x − x̄)² = 82.5
- Sxy = Σ(x − x̄)(y − ȳ) = 164.7
- Slope = 164.7 ÷ 82.5 = 1.9964
- Intercept = 11.14 − 1.9964 × 5.5 = 0.1600
- Equation: ŷ = 0.1600 + 1.9964x, with r = 0.9995 and R² = 0.9991
The slope of roughly 2 says y doubles x. The intercept near zero says the line passes almost through the origin. Predicting at x = 12 gives ŷ ≈ 24.12 — but note that 12 lies outside the observed range of 1 to 10, so the calculator flags it as an extrapolation.
Assumptions worth checking
- Linearity. The relationship must actually be a straight line. Curved data fitted with a line produces residuals with a clear U or arch shape.
- Independence. Observations must not be related to one another. Time series data usually violates this — consecutive measurements are correlated — and needs methods that account for it.
- Constant variance. Residual spread should be similar across the range of x. Residuals that fan out as x grows indicate heteroscedasticity, which does not bias the slope but does invalidate the standard errors.
- Roughly normal residuals. Needed for the t statistic and any p-value, though the slope estimate itself is unaffected.
- No dominant outliers. A single point far from the rest, especially at an extreme x, can pull the entire line. Check whether removing it changes the slope materially; if it does, say so in your write-up.
Frequently asked questions
Does a strong correlation prove causation?
Which variable should be x?
Can I predict outside my data range?
How many data points do I need?
What if my data is curved?
Why is my intercept negative when all my data is positive?
Is my data stored?
Next steps
The standard error of the estimate on this page is a standard deviation of residuals — the standard deviation calculator shows how that quantity is constructed. To judge whether an individual residual is unusually large, standardise it with the z-score calculator. To put an interval around a mean rather than a slope, use the confidence interval calculator.