Multiple Regression Calculator
Test cases replayed : 2 of 2 match · Methodology · No outside source listed
Enter up to 8 rows of data, each with two predictors x₁ and x₂ and the outcome y, and say how many rows to use. The calculator fits the least-squares plane y = b₀ + b₁x₁ + b₂x₂ and predicts y for new values.
Result
Predicted y at (x₁, x₂)
Intercept b₀
- Coefficient b₁ of x₁
- Coefficient b₂ of x₂
- R² (share of the variance of y explained)
- Adjusted R²
- Standard error of the regression
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Number of rows used (4 to 8): enter a number from 4 to 8.
- Row 1: x₁: enter a number.
- Row 1: x₂: enter a number.
- Row 1: y: enter a number.
- Row 2: x₁: enter a number.
- Row 2: x₂: enter a number.
- Row 2: y: enter a number.
- Row 3: x₁: enter a number.
- Row 3: x₂: enter a number.
- Row 3: y: enter a number.
- Row 4: x₁: enter a number.
- Row 4: x₂: enter a number.
- Row 4: y: enter a number.
- Row 5: x₁: enter a number.
- Row 5: x₂: enter a number.
- Row 5: y: enter a number.
- Row 6: x₁: enter a number.
- Row 6: x₂: enter a number.
- Row 6: y: enter a number.
- Row 7: x₁: enter a number.
- Row 7: x₂: enter a number.
- Row 7: y: enter a number.
- Row 8: x₁: enter a number.
- Row 8: x₂: enter a number.
- Row 8: y: enter a number.
- Predict at x₁ =: enter a number.
- Predict at x₂ =: enter a number.
- Read the result: Predicted y at (x₁, x₂); the panel also shows Intercept b₀, Coefficient b₁ of x₁, Coefficient b₂ of x₂, R² (share of the variance of y explained), Adjusted R² and Standard error of the regression.
How this calculator works
Ordinary least squares chooses b₀, b₁ and b₂ that make the sum of squared residuals Σ(y − b₀ − b₁x₁ − b₂x₂)² as small as possible.
With the centered sums S₁₁ = Σx₁² − (Σx₁)²/n, S₂₂ = Σx₂² − (Σx₂)²/n, S₁₂ = Σx₁x₂ − Σx₁Σx₂/n, S₁y = Σx₁y − Σx₁Σy/n and S₂y = Σx₂y − Σx₂Σy/n, the normal equations give b₁ = (S₁y S₂₂ − S₂y S₁₂) ÷ D and b₂ = (S₁₁ S₂y − S₁₂ S₁y) ÷ D, with D = S₁₁S₂₂ − S₁₂², then b₀ = ȳ − b₁x̄₁ − b₂x̄₂.
R² = regression sum of squares ÷ total sum of squares; adjusted R² = 1 − (1 − R²)(n − 1) ÷ (n − 3); standard error = √(SSE ÷ (n − 3)), with n − 3 degrees of freedom for three fitted coefficients.
Rows beyond the number used are ignored. If x₁ or x₂ is constant, or one is an exact linear function of the other (x₂ = m + k x₁), D = 0 and the coefficients cannot be found (the results show —).
Worked example
| Number of rows used (4 to 8) | 6 |
|---|---|
| Row 1: x₁ | 1 |
| Row 1: x₂ | 4 |
| Row 1: y | 10 |
| Row 2: x₁ | 2 |
| Row 2: x₂ | 3 |
| Row 2: y | 12 |
| Row 3: x₁ | 3 |
| Row 3: x₂ | 5 |
| Row 3: y | 17 |
| Row 4: x₁ | 4 |
| Row 4: x₂ | 2 |
| Row 4: y | 15 |
| Row 5: x₁ | 5 |
| Row 5: x₂ | 6 |
| Row 5: y | 24 |
| Row 6: x₁ | 6 |
| Row 6: x₂ | 3 |
| Row 6: y | 22 |
| Row 7: x₁ | 0 |
| Row 7: x₂ | 0 |
| Row 7: y | 0 |
| Row 8: x₁ | 0 |
| Row 8: x₂ | 0 |
| Row 8: y | 0 |
| Predict at x₁ = | 4 |
| Predict at x₂ = | 4 |
| Predicted y at (x₁, x₂) | 18.2394 |
|---|---|
| Intercept b₀ | 1.6338 |
| Coefficient b₁ of x₁ | 2.6426 |
| Coefficient b₂ of x₂ | 1.5088 |
| R² (share of the variance of y explained) | 0.9969 |
| Adjusted R² | 0.9948 |
| Standard error of the regression | 0.3981 |
Frequently asked questions
How many rows do I need?
At least 4 to have one degree of freedom left; with so few rows the coefficients are very uncertain. Statistical software handles larger data sets and gives p-values.
What does b₁ mean?
The change in y predicted for a one-unit increase in x₁ when x₂ stays the same.
Why is adjusted R² lower than R²?
It charges each predictor one degree of freedom, so adding a predictor raises it only when the gain in fit outweighs that cost.