How to use it
- Type each pair of x and y on its own line in Pairs of x and y, with a space between the two numbers.
- Type an x in Predict y for this x if you want a prediction; leave it empty otherwise.
- Read Least-squares line, the Correlation r and R², and the standard errors.
- Check the Residuals table and the chart, then go through How it is worked out.
The least-squares line
The line y = a + bx is chosen so that the squared vertical distances from the points to the line add up to the least possible total. The slope is b = Sxy ÷ Sxx, where Sxy and Sxx add up the products and squares of the deviations from the means, and the intercept is a = ȳ − b x̄.
The correlation r = Sxy ÷ √(Sxx × Syy) lies between −1 and 1. R² = r² is the share of the variation in y that the line explains.
b = Sxy ÷ Sxx
a = ȳ − b × x̄
r = Sxy ÷ √(Sxx × Syy), R² = r²
Standard errors and residuals
A residual is the difference y − ŷ between a point and the line. The residual standard error s = √(SSE ÷ (n − 2)) measures their typical size, and the standard errors of the slope and the intercept show how precisely they are estimated from the data.
A correlation close to 1 or −1 does not show that x causes y; it shows only that the points lie close to a straight line.
SSE = Σ (y − ŷ)², s = √(SSE ÷ (n − 2))
SE(b) = s ÷ √Sxx, SE(a) = s × √(1/n + x̄² ÷ Sxx)
What the calculator does not cover
- More than one x variable (multiple regression), curves, and transformed data.
- Confidence intervals and significance tests for the slope; use the standard errors with your own critical value.
- More than 200 pairs in one calculation, and pairs with a missing value.
Worked example: x = 1 to 5 and y = 2, 4, 5, 4, 5
The means are x̄ = 3 and ȳ = 4. Sxx = 10, Syy = 6 and Sxy = 6, so the slope is b = 6 ÷ 10 = 0.6 and the intercept is a = 4 − 0.6 × 3 = 2.2. The line is y = 0.6x + 2.2.
The correlation is r = 0.7746, so R² = 0.6. The standard error of the slope is 0.2828, and the prediction at x = 6 is 0.6 × 6 + 2.2 = 5.8.
| Result | |
|---|---|
| Slope b | 0.6 |
| Intercept a | 2.2 |
| Correlation r, R² | 0.7746, 0.6 |
| Prediction at x = 6 | 5.8 |
Frequently asked questions
How do I enter the data?
Put each pair on its own line, with the x value, a space and the y value. Use a point for decimals in English, or a comma in Turkish. Lines that do not hold exactly two numbers are reported with their line number.
What does R² tell me?
R² is the share of the variation in y that the line explains, between 0 and 1. An R² of 0.6 means that 60% of the variation in y is accounted for by x in a straight-line model.
What is a residual?
A residual is the observed y minus the fitted value ŷ on the line. Positive residuals are points above the line and negative ones are points below it, and the residuals add up to 0 for a least-squares line.
Why does the chart use equal steps for the x values?
The chart is a line chart with the points in order of x. The x labels are spaced evenly, so with very uneven x values the shape of the line is only a guide; the table gives the exact values.
Why do I need at least three pairs?
The standard errors use n − 2 degrees of freedom, so two pairs fit a line exactly and tell you nothing about its error. Three pairs is the least that gives a standard error.
Are the numbers I enter sent to a server?
No. The regression runs in your browser, and nothing you type is sent to us.
Sources
- Wikipedia: Simple linear regression, the least-squares formulas
- Wikipedia: Coefficient of determination, R²
- Wikipedia: Least squares
Figures and text last checked on Tuesday, November 10, 2026.