How to use the Regression Line Calculator
- 1. Enter x and yType the paired values in the same order.
- 2. Add an estimate (optional)Enter an x to estimate y, or a y to estimate x.
- 3. Read the linesSee y on x, x on y, byx, bxy, r and the dx, dy table.
The two regression lines
With means x̄ and ȳ and deviations dx = x − x̄, dy = y − ȳ:
y on x: y − ȳ = byx (x − x̄), with byx = Σdxdy / Σdx².
x on y: x − x̄ = bxy (y − ȳ), with bxy = Σdxdy / Σdy².
The correlation coefficient is r = Σdxdy / √(Σdx² Σdy²), and r² = byx × bxy. Both lines pass through (x̄, ȳ). Use y on x to predict y and x on y to predict x; they are different lines unless r = ±1.
Worked example
Take x = 1, 2, 3, 4, 5 and y = 2, 5, 3, 8, 7. Then x̄ = 3 and ȳ = 5. The deviations give Σdx² = 10, Σdy² = 26 and Σdxdy = 13.
byx = 13/10 = 1.3, so y − 5 = 1.3(x − 3), which is y = 1.3x + 1.1. bxy = 13/26 = 0.5, so x − 3 = 0.5(y − 5), which is x = 0.5y + 0.5. Finally r = √(1.3 × 0.5) = √0.65 = 0.8062, a fairly strong positive correlation. At x = 6 the estimate is y = 8.9.
Reading the result
byx and bxy always have the same sign as r, and their product can never exceed 1. If you get a product above 1 in your own working, recheck the sums. Regression shows association, not cause. For a single least-squares line with R² and residuals, use the linear regression calculator; for r alone, try the correlation coefficient calculator.
Frequently asked questions
Why are there two regression lines?
y on x minimises errors in y and x on y minimises errors in x. They coincide only when the correlation is perfect.
How do I find r from the regression coefficients?
r = ±√(byx × bxy), taking the sign of byx and bxy.
Where do the two lines meet?
At the point of means (x̄, ȳ).
Is this calculator free?
Yes. You enter your name and WhatsApp number once when you see your result, and other Uncodemy tools then open without the form.