Multiple Regression Calculator

Fit Y = b₀ + b₁X₁ + b₂X₂ + … with any number of predictors. Per-coefficient significance, R² and Adjusted R², overall F-test, plus a residuals plot and standardised-coefficient chart.

Data table — Y in the first column, X₁, X₂, … after
#YX1X2
1
2
3
4
5
6

Multiple regression explained, step by step

Each concept has a plain-English definition, the formula this calculator uses, a small diagram and a worked example — all in one card so the maths lines up with the visual.

1. The multiple-regression model

Multiple regression extends the y = m·x + b line to two or more predictors. Instead of a line through a scatter it fits a flat plane (2 predictors) or a hyperplane (more), choosing the intercept b₀ and slopes b₁ … bₖ that make the plane sit as close as possible to all data points at once.

Y = b₀ + b₁·X₁ + b₂·X₂ + … + bₖ·Xₖ + ε
bⱼpartial slope for Xⱼ (others held fixed)·εresidual — what the model can't explain
Example
Given
n = 6
k = 2 predictors
Substitute
Ŷ = 1.833 + 2.028·X₁ + 0.694·X₂
Answer
each coefficient is a partial effect

2. Least-squares fit via matrices

The best-fit coefficients minimise the sum of squared residuals Σ(y − ŷ)². For multiple predictors the compact closed form uses matrix algebra — the calculator builds X, computes XᵀX and Xᵀy, and solves for the coefficient vector b.

b = (XᵀX)⁻¹ Xᵀy
Xdesign matrix (columns of predictors + 1s)·yvector of observed Y values
b = (XᵀX)⁻¹ Xᵀ y
If XᵀX is singular, two predictors carry the same information → the calculator flags multicollinearity.
Example
Given
default 6-row dataset
Substitute
solve (XᵀX)⁻¹ Xᵀy
Answer
b₀ = 1.833
b₁ = 2.028
b₂ = 0.694

3. R² vs Adjusted R² — the important one

R² is the fraction of Y's variance the model explains. It has one bad property: adding any new predictor — even random noise — can only push R² up, never down. Adjusted R² pays a penalty for each extra predictor, so it actually falls if a variable isn't earning its keep.

Adj R² = 1 − (1 − R²) · (n − 1)/(n − k − 1)
nnumber of rows·knumber of predictors (excl. intercept)
Example
Given
n = 6
k = 2
R² = 0.9955
Substitute
1 − 0.0045·5/3
Answer
Adj R² ≈ 0.9926

4. Interpreting a coefficient — 'partial effect'

Each bⱼ is the expected change in Y for a one-unit rise in Xⱼ with every other predictor held constant. That 'holding constant' clause matters — b₁ = 2 doesn't mean 'X₁ up 1 ⇒ Y up 2' in the raw data; it means that after removing what X₂, X₃, … already explain, X₁ still moves Y by 2 per unit.

ŷ = b₀ + Σ bⱼ · xⱼ
Example
Given
b₁ = 2.028
b₂ = 0.694
Substitute
same-unit comparison via standardised chart
Answer
X₁ contributes more per SD than X₂

5. Overall F-test & per-coefficient p-values

The F-test asks a single yes/no question: does the whole model explain more than nothing? Per-coefficient t-statistics and p-values then ask, for each Xⱼ, whether it adds anything beyond the others. A tiny F p-value with no individual significant t is the classic sign of multicollinearity.

F = (R²/k) / ((1 − R²)/(n − k − 1))
df(k, n − k − 1) for the F distribution
Example
Given
R² = 0.9955
n = 6
k = 2
Substitute
(0.9955/2) / (0.0045/3)
Answer
F ≈ 334.5
p ≈ 0.0003

Features of this calculator

  • Any number of predictors — dynamic Add predictor / Add row controls (not capped at 2)
  • Full coefficient table: estimate, standard error, t-statistic and two-tailed p-value for every b
  • Both R² and Adjusted R², plus the overall F-test with p-value
  • Standardised-coefficient bar chart to compare each predictor's relative contribution on a common scale
  • Residuals-vs-predicted diagnostic plot to visually check model fit quality
  • Detects perfect multicollinearity (singular XᵀX) and reports it plainly
  • Show / hide step-by-step working for R², Adjusted R² and the F-test

Frequently asked questions

+How many predictors can I add?

Any number, as long as n > k + 1 (so residual degrees of freedom n − k − 1 ≥ 1).

+Should I look at R² or Adjusted R²?

Report both, decide with Adjusted R². Plain R² only ever rises when you add predictors — including useless ones — so it can't fairly compare models of different sizes.

+What does the p-value on each coefficient mean?

The two-tailed p-value for the null hypothesis that the coefficient's true value is zero, holding the other predictors constant.

+Why can the F-test be significant while no individual coefficient is?

Classic multicollinearity — the predictors collectively explain a lot, but each is redundant given the others, so standard errors inflate and no single t-stat is significant.

+How is the F-statistic computed?

F = (R²/k) / ((1 − R²)/(n − k − 1)) on (k, n − k − 1) degrees of freedom.

+What if I only have one predictor?

Use the Simple Linear Regression Calculator; it also plots the fitted line against the scatter.

Related calculators