Skip to content
Statculator
Correlation & Regression

Multiple Linear Regression Calculator

Free multiple linear regression calculator with steps. Enter Y and up to 8 X variables to get the equation, p-values, R², adjusted R², ANOVA and VIF.

Free, no sign-up Runs in your browserBy Hira Noor, BS MathematicsUpdated

Variables (one column of values each)
n = 12
n = 12
n = 12

The first box is the response Y; each further box is a predictor. List values in the same observation order in every box. Use 0/1 codes for yes/no predictors.

2 values

Optional. One value per predictor, in order (X1, X2, …). Leave blank to skip the prediction.

Ordinary least squares with an intercept. Tests assume independent observations and normally distributed residuals with constant variance.

Results

Regression equation
ŷ = 11.5912 + 1.8204·X1 − 1.0485·X2
R²
0.9905
99.05% of the variation in Y explained
Adjusted R²
0.9884
n = 12, k = 2
Predicted Y at 150, 10
274.1728
95% PI 256.9461 to 291.3995

The model is statistically significant at α = 0.05

F(2, 9) = 468.3079, p = 8.01 × 10⁻¹⁰. Taken together, the predictors explain more of the variation in Y than chance alone would.

F statistic (2, 9)
468.3079
p-value for F
8.01 × 10⁻¹⁰
Residual standard error, s
7.2142
Multiple R
0.9952
Observations, n
12
Predictors, k
2
Residual df
9
Significant predictors (p ≤ 0.05)
X1

Interpretation: Holding the other predictor fixed, a 1-unit increase in X1 changes predicted Y by 1.8204, and a 1-unit increase in X2 changes predicted Y by -1.0485. The model explains 99.05% of the variation in Y (adjusted R² = 0.9884), with a typical prediction error of about 7.2142.

Scatter plot of 12 points with fitted line100150200250300350400Observed Y140160180200220240260280300320340360380Fitted value, ŷ(196.1124, 204)(276.2698, 282)(227.2787, 225)(270.3131, 264)(143.9757, 144)(167.4228, 161)(372.5347, 366)(290.2802, 304)(283.275, 277)(211.1713, 208)(332.9802, 335)(243.3861, 245)Observed = fitted
Points close to the diagonal are predicted well. Vertical distance from the line is each residual.

Coefficients

TermEstimateStd. errortp-value95% CI lower95% CI upper
Intercept11.591224.24960.4780.644-43.265266.4476
X11.82040.128214.2011.81 × 10⁻⁷1.53052.1104
X2-1.04850.4811-2.17950.0572-2.13680.0398

Highlighted predictors are significant at α = 0.05 (t-tests with df = 9).

Analysis of variance

SourcedfSSMSFp-value
Regression248745.848124372.9241468.30798.01 × 10⁻¹⁰
Residual9468.401952.0447
Total1149214.25

Multicollinearity check

PredictorR² on the other predictorsVIF
X10.72343.6153
X20.72343.6153

VIF = 1 / (1 − R²ⱼ). Values above 5 suggest moderate and above 10 strong multicollinearity.

Prediction at X1 = 150, X2 = 10

Intervalŷ₀95% lower95% upper
Confidence interval for the mean Y274.1728268.6565279.689
Prediction interval for one new Y274.1728256.9461291.3995

t₀.₀₂₅ with 9 df = 2.2622. The prediction interval is wider because it adds the scatter of single observations around the fitted plane.

Fitted values and residuals

#YX1X2ŷResidual
120411015196.11247.8876
22821508276.26985.7302
322513020227.2787-2.2787
42641455270.3131-6.3131
51449030143.97570.0243
616110025167.4228-6.4228
73662003372.5347-6.5347
830416012290.280213.7198
927715510283.275-6.275
1020812018211.1713-3.1713
113351806332.98022.0198
1224514022243.38611.6139

Step-by-step solution

  1. 1

    Write the model

    n = 12 observations, k = 2 predictors, so p = k + 1 = 3 coefficients.

    ŷ = b₀ + b₁·X1 + b₂·X2
  2. 2

    Form the normal equations (XᵀX)b = Xᵀy

    X has a column of 1s for the intercept followed by one column per predictor.

    XᵀX =
    [ 12 1680 174 ]
    [ 1680 246650 21765 ]
    [ 174 21765 3336 ]
    Xᵀy = [ 3015, 445665, 38141 ]
  3. 3

    Solve for the coefficients, b = (XᵀX)⁻¹Xᵀy

    b₀ (Intercept) = 11.5912
    b₁ (X1) = 1.8204
    b₂ (X2) = -1.0485
    ŷ = 11.5912 + 1.8204·X1 − 1.0485·X2
  4. 4

    Find the residual variance

    SSE = Σ(y − ŷ)² = 468.4019
    MSE = SSE / (n − k − 1) = 468.4019 / 9 = 52.0447
    s = √MSE = 7.2142
  5. 5

    Test each coefficient (H₀: βⱼ = 0)

    SE(bⱼ) = √[MSE × (XᵀX)⁻¹ⱼⱼ] and t = bⱼ / SE(bⱼ) with df = 9.

    Intercept: t = 11.5912 / 24.2496 = 0.478, p = 0.644
    X1: t = 1.8204 / 0.1282 = 14.201, p = 1.81 × 10⁻⁷
    X2: t = -1.0485 / 0.4811 = -2.1795, p = 0.0572
  6. 6

    Compute R² and adjusted R²

    SST = 49214.25, SSR = SST − SSE = 48745.8481
    R² = SSR / SST = 0.9905
    R²adj = 1 − (1 − R²)(n − 1) / (n − k − 1) = 1 − (1 − 0.9905)(11) / 9 = 0.9884
  7. 7

    Run the overall F-test (H₀: all slopes are 0)

    F = (SSR / k) / MSE = (48745.8481 / 2) / 52.0447 = 468.3079
    p = P(F(2, 9) ≥ 468.3079) = 8.01 × 10⁻¹⁰
  8. 8

    Predict Y at X1 = 150, X2 = 10

    With x₀ = (1, 150, 10), the leverage term is h = x₀ᵀ(XᵀX)⁻¹x₀ = 0.1143.

    ŷ₀ = 11.5912 + 1.8204 × 150 − 1.0485 × 10 = 274.1728
    SE(mean) = √(MSE × h) = 2.4385, SE(new) = √(MSE × (1 + h)) = 7.6152
    95% PI = 274.1728 ± 2.2622 × 7.6152 = 256.9461 to 291.3995

What is a Multiple Linear Regression Calculator?

A multiple linear regression calculator fits ŷ = b₀ + b₁X₁ + … + bₖXₖ, predicting one numeric response Y from two or more predictors at once by least squares. It returns each coefficient with its standard error, t-test, p-value and 95% confidence interval, plus R², adjusted R², the ANOVA table with the overall F-test, a VIF for each predictor and the full working step by step.

What the Multiple Linear Regression Calculator does

Enter the response Y in the first box and up to eight predictors in the boxes after it. The default is the common case with 3 variables: one response and two predictors. The calculator solves the normal equations (XᵀX)b = Xᵀy and reports a full regression summary: a coefficient table with 95% confidence intervals, an optional predicted Y with confidence and prediction intervals, the ANOVA table, R², adjusted R², the F-test, fitted values and residuals, and a variance inflation factor (VIF) for each predictor to flag multicollinearity.

Every result comes with steps: the XᵀX matrix and Xᵀy vector (for up to three predictors), the solved coefficients, SSE and MSE, each t-test, R² and the F-test, so you can check homework or a software printout line by line. The numbers match R’s lm(), Excel’s LINEST and the Data Analysis ToolPak regression output for the same data.

A multiple regression calculator answers questions a one-predictor model cannot: how much does house price rise with floor area once age is taken into account? Each slope is a partial effect, estimated with the other predictors held fixed. With only one predictor, the Linear Regression Calculator gives the same numbers plus prediction intervals; for a yes/no outcome, use logistic regression instead.

How to use the Multiple Linear Regression Calculator

  1. Put the outcome you want to explain in Y (response), as a list of numbers separated by commas, spaces or line breaks. You can paste a column straight from Excel or Google Sheets.
  2. Enter each predictor in its own box (X1, X2, …) in the same observation order as Y. Use Add variable for more predictors, up to eight. Code yes/no predictors as 0 and 1.
  3. Check that every box has the same number of values; the calculator will tell you if they differ or if there are too few observations.
  4. Optionally enter one value per predictor in Predict Y at X1, X2, … = to get the predicted Y with a 95% confidence interval for the mean and a prediction interval for one new observation.
  5. Read the equation, R² and the F-test, then the coefficient table for each predictor’s effect and p-value. Check the VIF table and the residuals before drawing conclusions.

How to calculate multiple linear regression

By hand, or to check the calculator’s steps, the calculation runs in six moves. Each one appears in the step-by-step solution above.

  1. Build the design matrix X: a column of 1s for the intercept, then one column per predictor. Y is the response vector.
  2. Form the normal equations: compute XᵀX (sums of squares and cross-products of the columns) and Xᵀy.
  3. Solve for the coefficients: b = (XᵀX)⁻¹Xᵀy gives the intercept b₀ and the slopes b₁ … bₖ.
  4. Get the residuals: ŷ = Xb for each row, residual = y − ŷ, and SSE = Σ(y − ŷ)².
  5. Find the error variance: MSE = SSE / (n − k − 1). Each SE(bⱼ) is √[MSE · (XᵀX)⁻¹ⱼⱼ], and t = bⱼ / SE(bⱼ).
  6. Summarize the fit: R² = 1 − SSE / SST, adjusted R² = 1 − (1 − R²)(n − 1)/(n − k − 1), and F = MSR / MSE.

Multiple linear regression formula

In matrix form, X is the n × (k + 1) design matrix whose first column is all 1s.

Model
ŷ = b₀ + b₁X₁ + b₂X₂ + … + bₖXₖ
Least-squares coefficients
b = (XᵀX)⁻¹ Xᵀy
Coefficient standard errors
SE(bⱼ) = √[ MSE · (XᵀX)⁻¹ⱼⱼ ], MSE = SSE / (n − k − 1)
Overall F-test
F = (SSR / k) / (SSE / (n − k − 1))
Adjusted R²
R²adj = 1 − (1 − R²)(n − 1) / (n − k − 1)
Formula symbols
SymbolMeaning
nnumber of observations
knumber of predictors (not counting the intercept)
bⱼestimated partial effect of predictor j, holding the others fixed
SSR, SSEregression and residual sums of squares
VIF1 / (1 − R²ⱼ), where R²ⱼ comes from regressing Xⱼ on the other predictors

Each t-test uses n − k − 1 degrees of freedom. The F-test compares the full model with a model that has only an intercept.

If one predictor is an exact linear combination of the others, XᵀX cannot be inverted and the coefficients are not unique. The calculator reports this instead of returning misleading numbers.

Sources: Penn State STAT 462, the multiple linear regression model, its matrix formulation and VIFs; NIST/SEMATECH e-Handbook, linear least squares regression.

Worked example

Worked example: house price, size and age

Problem. Twelve houses sold for Y = 204, 282, 225, 264, 144, 161, 366, 304, 277, 208, 335, 245 ($1,000s). Their floor areas X1 (m²) were 110, 150, 130, 145, 90, 100, 200, 160, 155, 120, 180, 140 and their ages X2 (years) were 15, 8, 20, 5, 30, 25, 3, 12, 10, 18, 6, 22. How do size and age relate to price?

  1. 01Normal equations (X1 = floor area, X2 = age): XᵀX has rows [12, 1680, 174], [1680, 246650, 21765], [174, 21765, 3336] and Xᵀy = [3015, 445665, 38141].
  2. 02Solving gives ŷ = 11.5912 + 1.8204·X1 − 1.0485·X2.
  3. 03SSE = 468.4019 with n − k − 1 = 9 df, so MSE = 52.0447 and s = 7.2142.
  4. 04Floor area: SE = 0.1282, t = 14.2010, p < 0.001. Age: SE = 0.4811, t = −2.1795, p = 0.0572.
  5. 05R² = 48745.8481 / 49214.25 = 0.9905; adjusted R² = 0.9884.
  6. 06MS regression = SSR / k = 48745.8481 / 2 = 24372.9241, so F = 24372.9241 / 52.0447 = 468.3079 on (2, 9) df, p ≈ 8.0 × 10⁻¹⁰.
  7. 0795% CIs (t₀.₀₂₅,₉ = 2.2622): floor area 1.5305 to 2.1104; age −2.1368 to 0.0398, which includes 0. Prediction for a 150 m², 10-year-old house: ŷ = 11.5912 + 1.8204(150) − 1.0485(10) = 274.17, about $274,200, with a 95% prediction interval of 256.95 to 291.40.

Answer. Holding age fixed, each extra square metre adds about $1,820 to the price; holding size fixed, each extra year of age lowers it by about $1,050, although that effect just misses significance at the 5% level (p = 0.057). Size and age are correlated (r = −0.85, VIF ≈ 3.6), which widens the age interval.

Interpreting multiple regression coefficients

A coefficient in multiple regression is a partial effect: the expected change in Y for a one-unit increase in that predictor when every other predictor in the model stays the same. That is why a coefficient can change size, or even sign, when you add or remove other variables.

Compare effects across predictors with care. Coefficients are in the units of their own predictor, so a large coefficient is not necessarily a more important variable. Standardizing the predictors (subtracting the mean and dividing by the SD) before fitting puts them on a common scale.

Reading the ANOVA table: MS regression, MSE and F

The ANOVA table splits the total variation in Y into the part the predictors explain (regression) and the part left over (residual). Each mean square is a sum of squares divided by its degrees of freedom: MS regression = SSR / k and MSE = SSE / (n − k − 1). Their ratio is the F statistic, and its p-value comes from the F distribution with (k, n − k − 1) df.

ANOVA for the house-price example (n = 12, k = 2)
SourcedfSSMSF
Regression248,745.8524,372.92468.31
Residual9468.4052.04
Total1149,214.25

The same model in R, Excel and Python

In R, the lm formula puts the response on the left of a tilde and the predictors on the right, joined by plus signs: y ~ x1 + x2 fits ŷ = b₀ + b₁x₁ + b₂x₂, and summary() prints the coefficient table, R² and F-test this calculator shows. The intercept is included unless you add − 1 or + 0.

ToolHow to fit Y on X1 and X2Matches
Rsummary(lm(y ~ x1 + x2, data = d))Coefficients, SE, t, p, R², adjusted R², F
Excel=LINEST(Y_range, X1:X2_range, TRUE, TRUE)Coefficients (listed in reverse order), SE, R², F, SS
Excel ToolPakData → Data Analysis → RegressionFull summary and ANOVA table
Pythonstatsmodels.formula.api.ols("y ~ x1 + x2", d).fit().summary()Full summary

Common use cases

  • Real estate and pricing: valuing a property from size, age, location codes and other features.
  • Economics and business: explaining sales from price, advertising and season at the same time.
  • Health research: estimating the effect of an exposure on an outcome while adjusting for age, sex and other confounders.
  • Engineering: modelling output or strength from several process settings.
  • Education: relating exam results to study time, attendance and prior grades together.

Assumptions and limitations

  • Linearity and additivity: the model assumes each predictor’s effect is a straight line and the effects add up. Interactions and curves must be added as extra columns (for example X₁·X₂ or X₁²).
  • Residual assumptions: p-values and intervals assume independent, normally distributed residuals with constant variance. Check the residual column for patterns or outliers.
  • Multicollinearity: highly correlated predictors make individual coefficients unstable even when the overall fit is good. Watch VIFs above 5 to 10.
  • Sample size: with fewer than about 10 observations per predictor, the model is likely to overfit and adjusted R² will be well below R².
  • Categorical predictors: code a category with c levels as c − 1 separate 0/1 columns; entering codes 1, 2, 3 as one column forces an unrealistic equal-step effect.
  • Causation: coefficients describe associations in the data. Only a designed experiment, or careful causal reasoning, supports a causal reading.

Frequently asked questions

How do you calculate multiple linear regression?

Put a column of 1s and one column per predictor into a design matrix X, then solve the normal equations b = (XᵀX)⁻¹Xᵀy for the coefficients. From the residuals y − ŷ, get SSE and MSE = SSE / (n − k − 1), then the standard errors, t-tests, R² and the F-test. This calculator shows each of those steps for your data.

What is the lm formula in R for multiple regression?

lm(y ~ x1 + x2 + x3, data = d) regresses y on three predictors with an intercept; summary() of that model gives the same coefficients, standard errors, p-values, R² and F-test as this calculator. Use y ~ x1 * x2 to add the interaction x1·x2 as well as both main effects.

How do I calculate MS regression?

Divide the regression sum of squares by its degrees of freedom, the number of predictors: MSR = SSR / k. In the house example, SSR = 48,745.85 with k = 2, so MSR = 24,372.92. Dividing MSR by MSE (52.04) gives F = 468.31.

How do I interpret a coefficient in multiple linear regression?

Each coefficient is the estimated change in the mean of Y for a one-unit increase in that predictor, with all other predictors in the model held constant. For example, a floor-area coefficient of 1.82 (price in $1,000s, area in m²) means each extra square metre adds about $1,820, comparing houses of the same age.

What is the difference between R² and adjusted R² in multiple regression?

R² is the share of the variation in Y explained by the model, and it never decreases when you add a predictor. Adjusted R² penalizes the number of predictors relative to the sample size, so it only rises if a new variable improves the fit more than chance would. Use adjusted R² to compare models with different numbers of predictors.

What is multicollinearity and how do I detect it?

Multicollinearity means some predictors are strongly correlated with each other, so the model cannot cleanly separate their effects. It inflates standard errors and can flip coefficient signs. Detect it with the variance inflation factor: a VIF above 5 suggests moderate and above 10 strong multicollinearity.

How many observations do I need for multiple regression?

You need more observations than coefficients (n > k + 1) just to estimate the model and its errors. For stable, reproducible results, a common guideline is at least 10 to 20 observations per predictor, so a model with three predictors should have roughly 30 to 60 observations.

Why is the F-test significant when none of the t-tests are?

This happens when predictors are correlated with each other. Together they explain Y well, so the F-test is significant, but each one’s unique contribution, after accounting for the others, is small and uncertain. Check the VIF values and consider dropping or combining overlapping predictors.

Can I use a yes/no variable as a predictor?

Yes. Code it as 0 and 1 (for example 0 = no garage, 1 = garage). Its coefficient is the estimated difference in mean Y between the two groups, holding the other predictors fixed. If the response itself is yes/no, use logistic regression instead.

Cite this page

Statculator. (2026, November 14). Multiple Linear Regression Calculator. Retrieved November 14, 2026, from https://statculator.com/correlation-regression/multiple-linear-regression-calculator/