Bivariate Regression Calculator

This bivariate regression calculator gives you both regression lines, y on x and x on y, with the correlation coefficient, covariance and R² from one set of paired data.

Separate with commas, spaces or new lines.

Same count as x, in the same order.

Checks on your data

  • 8 pairs is enough for a rough view of the relationship.
  • Correlation shows association, not cause. Check the scatter plot for curvature before trusting a straight line. Try curve fitting →

Results

Regression of y on x
ŷ = 0.17143 + 1.9786x
use to predict y from x
Regression of x on y
x̂ = -0.065105 + 0.50304y
use to predict x from y
Correlation r
0.997649
R²
0.995304
Covariance (sample)
11.8714
p-value for r (two-tailed)
< 0.0001
Means (x̄, ȳ)
4.5, 9.075
Pairs (n)
8
Check: byx × bxy = r²
0.995304
the two slopes multiply to r²
Scatter plot with the regression line of y on x (r = 0.998)
510152468xy
Calculation table
xyx − x̄y − ȳ(x − x̄)(y − ȳ)
12.3-3.5-6.77523.712
24.1-2.5-4.97512.438
35.8-1.5-3.2754.9125
48.4-0.5-0.6750.3375
59.70.50.6250.3125
612.51.53.4255.1375
713.62.54.52511.313
816.23.57.12524.938
Show step-by-step solution
  1. n = 8, x̄ = 4.5, ȳ = 9.075.
  2. Sxx = 42, Syy = 165.195, Sxy = 83.1.
  3. y on x: slope = Sxy ÷ Sxx = 1.97857, intercept = ȳ − slope·x̄ = 0.171429.
  4. x on y: slope = Sxy ÷ Syy = 0.503042, intercept = x̄ − slope·ȳ = -0.0651049.
  5. r = Sxy ÷ √(Sxx·Syy) = 0.997649, and byx × bxy = 0.995304 = r².
y on xslope = Sxy / Sxx
x on yslope = Sxy / Syy
Linkbyx × bxy = r²

What Is Bivariate Regression?

Bivariate regression looks at two variables measured on the same cases. Unlike a single fitted line, it recognises that there are two regression lines: one that predicts y from x and another that predicts x from y.

Paste your x and y values and the calculator returns both equations, the correlation r, the sample covariance, R² and a p-value for r. It also shows the check that the two slopes multiply to r², which is a quick way to catch arithmetic slips.

Use the y on x line to predict y and the x on y line to predict x. The two lines cross at the point of means, and they coincide only when the points lie exactly on a straight line.

How to Use the Bivariate Regression Calculator

  1. Paste the x values and the y values in matching order.
  2. Read the line of y on x to predict y, or the line of x on y to predict x.
  3. Use r and its p-value to judge how strong and how reliable the relationship is.

Bivariate Regression Formula

Regression of y on x

y−yˉ=byx(x−xˉ),byx=SxySxxy-\bar y=b_{yx}(x-\bar x),\quad b_{yx}=\frac{S_{xy}}{S_{xx}}

Regression of x on y

x−xˉ=bxy(y−yˉ),bxy=SxySyyx-\bar x=b_{xy}(y-\bar y),\quad b_{xy}=\frac{S_{xy}}{S_{yy}}

Correlation

r=byx bxy=SxySxxSyyr=\sqrt{b_{yx}\,b_{xy}}=\frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}

Bivariate Regression Variables Explained

SymbolMeaningNotes
byxSlope of the regression of y on xSxy / Sxx
bxySlope of the regression of x on ySxy / Syy
rCorrelation coefficientBetween −1 and 1
SxySum of products of deviations
x̄, ȳMeans of x and yBoth lines pass through (x̄, ȳ)

Bivariate Regression Worked Example

With the example values loaded in the calculator above, the steps are:

  1. n = 8, x̄ = 4.5, ȳ = 9.075.
  2. Sxx = 42, Syy = 165.195, Sxy = 83.1.
  3. y on x: slope = Sxy ÷ Sxx = 1.97857, intercept = ȳ − slope·x̄ = 0.171429.
  4. x on y: slope = Sxy ÷ Syy = 0.503042, intercept = x̄ − slope·ȳ = -0.0651049.
  5. r = Sxy ÷ √(Sxx·Syy) = 0.997649, and byx × bxy = 0.995304 = r².

Result: Regression of y on x = ŷ = 0.17143 + 1.9786x; Regression of x on y = x̂ = -0.065105 + 0.50304y.

Why there are two regression lines

Least squares minimises vertical distances for y on x and horizontal distances for x on y. The two lines are different unless the points fall exactly on a line (r = ±1).

Both lines pass through the point of means (x̄, ȳ). The weaker the correlation, the wider the angle between them.

Which line should you use?

Use y on x to predict y from a known x. Use x on y to predict x from a known y. Do not invert the first line to predict x: the result is biased toward the wrong answer unless r is close to ±1.

Where Bivariate Regression Is Used

Predicting in either direction

Estimate height from arm length, or arm length from height, using the matching line.

Exam problems on regression coefficients

Verify byx, bxy, r and the point of means in textbook questions.

Quick association check

Read r, covariance and the scatter plot before choosing a model.

Common Bivariate Regression Mistakes to Avoid

  • The product of the two slopes equals r². If your hand calculation breaks that identity, recheck the sums.
  • A strong r shows association, not cause.

Bivariate Regression Terms and Definitions

Bivariate data
Pairs of measurements on two variables for each case.
Regression coefficient
The slope of a regression line, byx or bxy.

Bivariate Regression FAQs

What is bivariate regression?

It is regression on two variables measured together. The usual output is a regression line, correlation and covariance for the pair.

What is the difference between regression of y on x and x on y?

They minimise different errors and give different lines. The first predicts y from x, the second predicts x from y.

How are the two regression coefficients related to r?

r = ±√(byx × bxy), and the sign of r matches the sign of both slopes.

Where do the regression lines meet?

At the point of means (x̄, ȳ).

Is bivariate regression the same as simple linear regression?

Simple linear regression usually means the y on x line only. Bivariate analysis also looks at x on y, correlation and covariance.

How many data pairs do I need?

At least 3 for this tool, but small samples give very uncertain slopes and a weak test of r.

Related calculators

Last updated 2026-11-09. See our disclaimer.