Regression and Correlation
Multiple Linear Regression Calculator
An intercept and two predictors are fitted by least squares through the normal equations, and the page reports every coefficient and the R squared.
Worksheet
Press Calculate to see the result.
An intercept and two predictors are fitted by least squares through the normal equations, and the page reports every coefficient and the R squared.
What this calculator answers
With two predictors the fitted surface is a plane: an intercept plus a slope for x1 plus a slope for x2. Least squares chooses the three coefficients that minimise the sum of squared vertical gaps. Those coefficients solve the normal equations, a 3 by 3 system built from the sums of the predictors and the response. R squared is still 1 minus the residual sum of squares over the total sum of squares. This page stops at the coefficients and R squared. It does not print coefficient tests.
The page fits y = b0 + b1 x1 + b2 x2 by least squares and reports R squared. At least five rows are required. Supporting counts and intermediate terms sit under the headline so a reader can see what was divided by what. When a checkbox or a tail setting changes the divisor or the rejection region, that choice appears in the steps rather than vanishing into a silent default.
The formula, written out
Least squares with two predictors uses this relationship.
y = b0 + b1 x1 + b2 x2, with coefficients from the normal equations
- b0. Intercept.
- b1. Coefficient of the first predictor.
- b2. Coefficient of the second predictor.
- R squared. 1 minus SSE over SST.
Each normal equation sets a derivative of the residual sum of squares to zero. The unique solution, when the predictors are not copies of each other, is the least-squares plane. The algebra is the named textbook identity for this worksheet. Intermediate products and quotients appear in order so a calculator and a pencil can agree to the displayed rounding. If a neighbouring page uses a different divisor or a continuity correction, that page says so on its own ticket.
A full worked example
Example loaded in the worksheet
The form is prefilled with a small example so every arithmetic step can be checked by hand. Change one field after you finish the walkthrough and confirm the ticket moves the way the formula predicts.
There are 6 rows, each read as y, then x1, then x2. This is least squares with two predictors and an intercept, solved from the 3 by 3 normal equations. The intercept b0 is 5.4455.
The coefficient on x1 is 3.0636 and the coefficient on x2 is 1.5818. The fitted equation is y = 5.4455 + (3.0636) x1 + (1.5818) x2. The mean of y is 15, SST is 84, and SSE is 0.2818.
R squared is 1 minus 0.2818 / 84 = 0.9966. The first row predicts 10.0909 against an observed y of 10.
| R-squared | 0.9966 |
|---|---|
| Intercept b0 | 5.4455 |
| Coefficient b1 | 3.0636 |
| Coefficient b2 | 1.5818 |
| Rows | 6 |
A second situation
The last response is lowered from 21 to 15
There are 6 rows, each read as y, then x1, then x2. This is least squares with two predictors and an intercept, solved from the 3 by 3 normal equations. The intercept b0 is 8.3909.
The coefficient on x1 is 2.6273 and the coefficient on x2 is 0.1636. The fitted equation is y = 8.3909 + (2.6273) x1 + (0.1636) x2. The mean of y is 14, SST is 42, and SSE is 11.6273.
R squared is 1 minus 11.6273 / 42 = 0.7232. The first row predicts 11.1818 against an observed y of 10.
| R-squared | 0.7232 |
|---|---|
| Intercept b0 | 8.3909 |
| Coefficient b1 | 2.6273 |
| Coefficient b2 | 0.1636 |
| Rows | 6 |
Changing the last y refits every coefficient, because each normal equation includes a sum that involves y. The second example changes the feature that this formula is sensitive to, and the ticket shows the new figure beside the same definition. That contrast is the fastest way to see which input owns the movement.
What moves when the input moves
The last y moved from 21 to 24. The headline result went from 0.9966 to 0.973.
The nudged inputs
There are 6 rows, each read as y, then x1, then x2. This is least squares with two predictors and an intercept, solved from the 3 by 3 normal equations. The intercept b0 is 3.9727.
The coefficient on x1 is 3.2818 and the coefficient on x2 is 2.2909. The fitted equation is y = 3.9727 + (3.2818) x1 + (2.2909) x2. The mean of y is 15.5, SST is 127.5, and SSE is 3.4455.
R squared is 1 minus 3.4455 / 127.5 = 0.973. The first row predicts 9.5455 against an observed y of 10.
| R-squared | 0.973 |
|---|---|
| Intercept b0 | 3.9727 |
| Coefficient b1 | 3.2818 |
| Coefficient b2 | 2.2909 |
| Rows | 6 |
How to read the result
Read b1 as the change in predicted y for a one-unit step in x1 while x2 is held at the same value inside the equation. That is a feature of the fitted plane, not automatically a causal effect. Say the unit, the sample size or contract terms, and the formula name in the same sentence as the figure. A number without those three pieces invites a later reader to invent a definition that this page never used.
Write the result with its unit, the inputs that produced it, and the name of the formula. Write the result with its unit, the inputs that produced it, and the name of the formula. If the ticket shows a decision sentence, quote the alpha and the tail with it. If the ticket shows a money or dose figure, quote the rate and the schedule that produced it.
Assumptions that have to stay true
- You intend a plane with exactly two predictors plus an intercept.
- At least five rows are typed, each as y, x1, x2.
- The three columns of the design are not linearly dependent.
- You want the least-squares fit and R squared, not coefficient p-values.
If an assumption above is false, do not average the discomfort away. Change the worksheet or change the question. A correct arithmetic step on the wrong model is still the wrong answer for the decision you are trying to make.
Mistakes that change the answer
- Entering rows as x1 x2 y. This page reads y first.
- Fitting two predictors on fewer than five rows on this page.
- Reading R squared as an adjusted figure. No adjustment for the extra predictor is applied.
- Interpreting b1 without saying x2 is the other term in the same equation.
Where a different calculator is the honest choice
Use the linear regression calculator for one predictor and a test of its slope. Use the quadratic regression calculator when the second column should be x squared from a single x. Use the coefficient of determination calculator when you already have SSE and SST. Related links under the essay open pages that keep their own formulas instead of hiding a mode switch inside this ticket.
When the job changes, move to a page built for that job: Linear Regression Calculator, Quadratic Regression Calculator, Coefficient of Determination Calculator.
Check yourself
A fitted equation is y = 1 + 2 x1 + 3 x2. What is the prediction at x1 = 1 and x2 = 1?
The prediction is 1 plus 2 plus 3, which is 6.
Using the result in a sentence
A price explained by size and age, or a score explained by two practice measures, is the shape of problem this plane fits. Keep the count, the unit, and the assumption list beside any copy of the number that leaves this browser tab.
Two predictors can split one underlying signal, so the separate coefficients can look unstable even when the plane predicts well. This page does not diagnose that split. Pair the headline with the steps before you staff a route, set a grade boundary, or compare two contracts from a single number.
Questions people ask next
01What definition does the Multiple Linear Regression Calculator commit to?
This page uses Least squares with two predictors: y = b0 + b1 x1 + b2 x2, with coefficients from the normal equations. Each normal equation sets a derivative of the residual sum of squares to zero. The unique solution, when the predictors are not copies of each other, is the least-squares plane. If a textbook uses a different divisor, a different continuity correction, or a different rounding rule, the last digits can move, so the definition is printed above the result. The worksheet asks for Rows as y x1 x2, and it refuses a blank that the formula cannot interpret. Keep that printed definition in the sentence you write next to the figure so a later reader can rebuild the arithmetic without guessing which convention you chose.
02How should the worked example be read out loud?
In the loaded example the r-squared is 0.9966. Read b1 as the change in predicted y for a one-unit step in x1 while x2 is held at the same value inside the equation. That is a feature of the fitted plane, not automatically a causal effect. Say the unit and the count before you say whether the number is large or small. Read the steps in order rather than jumping to the headline, because the intermediate terms are where a swapped percent and proportion usually hide. If the ticket shows both a primary figure and a comparison figure, name which one you are quoting.
03What is the fastest way to get a misleading result?
Entering rows as x1 x2 y. This page reads y first. Two predictors can split one underlying signal, so the separate coefficients can look unstable even when the plane predicts well. This page does not diagnose that split. A second common failure is leaving a checkbox or tail setting in the wrong state and then treating the number as if the default had matched your plan. Reset the example, change one input, and confirm the ticket moves in the direction the formula predicts before you trust a live run.
04When should I leave this page for a different calculator?
Use the linear regression calculator for one predictor and a test of its slope. Use the quadratic regression calculator when the second column should be x squared from a single x. Use the coefficient of determination calculator when you already have SSE and SST. The related links under the essay go to those worksheets, which keep their own formulas instead of hiding them in a mode switch. If the question changed from a summary to a test, from a payment to a refinance, or from a raw score to a percentile, switch pages rather than forcing this ticket to answer a job it was not built for.
05What belongs in the sentence next to the number?
The prediction is 1 plus 2 plus 3, which is 6. Name the formula, the sample size or the inputs, and the unit before you compare the figure with someone else's. A bare number without those three pieces cannot be audited when a score, a rate, or a lab value is challenged later. Store the inputs beside the result whenever the figure will travel into a report.