Multiple Regression Calculator

Multiple Regression Calculator

Fit a regression with two predictors — coefficients, R², F-test, t-tests, VIF and prediction intervals — from pasted data, with a residual plot and step-by-step working.

Each row is one observation: the outcome y first, then the two predictors x1 and x2, separated by commas, spaces or tabs. Paste two columns (y, x) for a simple regression instead.
R SQUARED
0.9519

The model explains 95.19% of the variation in Exam score (R² = 0.9519, F = 49.4979, p = 0.0005). Hours studied: p = 0.6345 (not significant). Practice tests: p = 0.0048 (significant).

Adjusted R²
0.9327
F statistic
49.4979
F p-value
0.0005
RMSE
2.9246
VIF (x1)
3.5862
VIF (x2)
3.5862

Calculation

    Coefficients

    TermEstimateStd. errortp-value
    Intercept39.83853.115212.78830.0001
    Hours studied (x1)0.43230.85460.50590.6345
    Practice tests (x2)7.16311.48684.81770.0048

    Each coefficient is the change in exam score for a one-unit increase in that predictor, holding the other predictor constant. The t column tests whether the coefficient is zero (df = 5).

    Prediction

    Fitted value
    78.2477
    ŷ at x1 = 6, x2 = 5
    95% CI (mean)
    [74.2315, 82.2639]
    Range for the mean exam score at x1 = 6, x2 = 5.
    95% PI (new obs.)
    [69.7243, 86.7711]
    Range for a single new observation — wider, because it includes the new point’s own noise.

    t* = 2.5706 on 5 df. Standard error for the mean response = 1.5624; for a new observation = 3.3157. The PI is wider because it adds the new point’s own noise (the +1 under the square root).

    Fitted values and residuals

    #Exam score (y)FittedResidual
    15054.5969-4.5969
    26462.19231.8077
    35855.46152.5385
    47270.22001.7800
    56363.4892-0.4892
    68078.24771.7523
    77171.5169-0.5169
    88486.2754-2.2754

    Residual plot

    Residuals plotted against fitted values. A random scatter around zero supports the model; a pattern (such as a curve) suggests a missing term.

    A multiple regression calculator fits a plane through data with two predictors. Paste three columns (y, x1, x2) and it returns the coefficients, their standard errors and t-tests, R², adjusted R², the F-test, VIF for each predictor, fitted values and residuals, and a prediction interval for new predictor values, with the full working shown.

    How to use the multiple regression calculator

    Paste your data with one observation per row: the outcome y first, then the two predictors x1 and x2, separated by commas, spaces or tabs. The calculator fits the model by least squares and updates every result as you type.

    1. Paste three columns — y, x1, x2 — one row per observation. The worked example below is already loaded.
    2. Name the variables if you like (the defaults are exam score, hours studied and practice tests), and choose the confidence level for the intervals.
    3. Read the headline R², then the coefficient table: each row is one term, with its estimate, standard error, t statistic and p-value.
    4. Switch to Predict mode, enter values for x1 and x2, and read off the fitted value with its confidence interval (for the mean) and prediction interval (for a new observation).

    Try it now: the loaded data give R² = 0.9519, F = 49.4979 (p = 0.0005) and the fitted equation ŷ = 39.8385 + 0.4323x1 + 7.1631x2. Paste two columns (y, x) instead and the calculator runs a simple regression — the same calculation the linear regression calculator performs.

    What is multiple regression?

    Multiple regression models an outcome y as a linear combination of two predictors: y = β₀ + β₁x1 + β₂x2 + ε, where ε is the error — the part of y the predictors cannot explain. Least squares chooses β₀, β₁ and β₂ to minimise the sum of the squared residuals, the gaps between the observed y values and the values the model predicts. The normal equations behind that choice are built from the sums of squares and cross-products of the variables — the same building blocks a covariance calculator reports.

    With one predictor the fitted line is a line on a scatter plot; with two it is a plane in three dimensions. The extra predictor earns its place only if it explains variation that the first predictor does not — which is exactly what adjusted R² and the t-tests check.

    Multiple regression is the workhorse of observational studies: it lets you ask “does x1 matter, once x2 is taken into account?” — a different question from “does x1 matter on its own?” The worked example below is a case where the two answers disagree.

    When to use it — and when not to: use multiple regression when you have a continuous outcome and two predictors you want to adjust for each other. Do not use it to prove causation — a regression only describes association, and two predictors that move together (see VIF below) can make individual coefficients hard to interpret. If the outcome is a count or a yes/no, or the relationship is curved, a different model is needed.

    How to read a coefficient: “holding the other predictor constant”

    Each coefficient is a slope with the other predictor held fixed. β₁ = 0.4323 means: for two students who took the same number of practice tests, one extra hour of study is associated with 0.43 extra exam marks. β₂ = 7.1631 means: for two students who studied the same number of hours, one extra practice test is associated with 7.16 extra marks.

    That “holding constant” is the whole point of multiple regression — and it is also why a coefficient can be small or non-significant even when the predictor looks important on its own. If hours studied and practice tests move together, then once practice tests are in the model, hours studied has little new information to add. The example below shows exactly that.

    TermEstimateWhat it means
    Intercept (β₀)39.8385Predicted exam score for a student with 0 hours studied and 0 practice tests — outside the data range, so read it as an anchor, not a real student.
    Hours studied (β₁)0.4323+0.43 marks per extra hour, practice tests held constant. Not significant (p = 0.6345).
    Practice tests (β₂)7.1631+7.16 marks per extra practice test, hours held constant. Significant (p = 0.0048).

    R², adjusted R² and the F-test

    R² is the share of the variation in y that the model explains: R² = SSR / SST, where SSR is the variation the model accounts for and SST is the total variation. Here R² = 0.9519 — the two predictors explain 95.19% of the variation in exam scores.

    Adjusted R² penalises extra predictors: adding a useless predictor always nudges R² up a little, but adjusted R² falls. Here adjusted R² = 0.9327, barely below R², which is consistent with the second predictor earning its place.

    The F-test asks whether the predictors, together, explain more than nothing: F = (SSR / p) / (SSE / (n − p − 1)). Here F = 49.4979 on (2, 5) degrees of freedom, p = 0.0005 — the model as a whole is clearly better than just guessing the mean. But a significant F does not mean every predictor is significant: the t-tests decide that one predictor at a time.

    VIF: are your predictors too alike?

    The variance inflation factor measures how much a predictor’s standard error is inflated by its correlation with the other predictors. VIF = 1 / (1 − R²ₗ), where R²ₗ comes from regressing predictor j on the other predictors. VIF = 1 means no correlation; VIF = 3.5862 here means the standard errors are about 1.9 times wider than they would be with uncorrelated predictors (√3.5862 = 1.894).

    As a rule of thumb, VIF above 5 is a worry and above 10 is serious: the coefficients become unstable and their p-values unreliable. Here VIF = 3.5862 — moderate. Hours studied and practice tests correlate at r = 0.8492, which is exactly why hours studied looks weak once practice tests are included. If VIF is high, consider dropping a predictor, combining them, or collecting more data.

    If the predictors are perfectly collinear — one is an exact multiple of the other — the regression cannot be fitted at all, and the calculator says so instead of returning numbers.

    Confidence interval vs prediction interval

    For a new set of predictor values the calculator gives two intervals, and the prediction interval is always wider. The confidence interval covers the mean response — the average exam score of all students with those predictor values. The prediction interval covers a single new student, so it must also allow for that student’s own variation around the mean.

    At 6 hours studied and 5 practice tests the fitted value is 78.2477. The 95% confidence interval for the mean is [74.2315, 82.2639]; the 95% prediction interval for one new student is [69.7243, 86.7711]. The extra width comes from the +1 under the square root in the prediction standard error — the new observation’s own noise. If you need the interval for a single future value, use the prediction interval; the confidence interval would be misleadingly narrow. The prediction interval calculator covers the one-predictor case in detail.

    Worked examples

    Example 1 — two predictors (the loaded data)

    Eight students, with hours studied (x1), practice tests taken (x2) and exam score (y): (1, 2, 50), (2, 3, 64), (3, 2, 58), (4, 4, 72), (5, 3, 63), (6, 5, 80), (7, 4, 71), (8, 6, 84). The means are ȳ = 67.75, x̄₁ = 4.5 and x̄₂ = 3.625.

    Solving the least-squares normal equations gives ŷ = 39.8385 + 0.4323x1 + 7.1631x2. The fitted values are 54.5969, 62.1923, 55.4615, 70.2200, 63.4892, 78.2477, 71.5169 and 86.2754, with residuals −4.5969, 1.8077, 2.5385, 1.7800, −0.4892, 1.7523, −0.5169 and −2.2754.

    The total sum of squares is SST = 889.5000. The residual sum of squares is SSE = 42.7662 and the regression sum of squares is SSR = 846.7338, so R² = 846.7338 / 889.5000 = 0.9519 and adjusted R² = 1 − (1 − 0.9519) × 7 / 5 = 0.9327. The residual variance is s² = 42.7662 / 5 = 8.5532, so RMSE = 2.9246.

    The F statistic is F = (846.7338 / 2) / (42.7662 / 5) = 49.4979 on (2, 5) degrees of freedom, p = 0.0005. The t-tests use 5 degrees of freedom: intercept t = 39.8385 / 3.1152 = 12.7883 (p = 0.0001); hours studied t = 0.4323 / 0.8546 = 0.5059 (p = 0.6345); practice tests t = 7.1631 / 1.4868 = 4.8177 (p = 0.0048).

    So the model fits well and practice tests are significant — but hours studied is not, once practice tests are in the model. That is not a mistake: the two predictors correlate at r = 0.8492 (VIF = 3.5862), so most of what hours studied explains is already explained by practice tests. On its own, hours studied looks important; adjusted for practice tests, it adds almost nothing. This is the most common reason a predictor “loses” significance in multiple regression, and it is a property of the data, not of the calculator.

    Prediction: for 6 hours and 5 practice tests, ŷ = 39.8385 + 0.4323 × 6 + 7.1631 × 5 = 78.2477. With t* = 2.5706 on 5 df, the 95% confidence interval for the mean is 78.2477 ± 2.5706 × 1.5624 = [74.2315, 82.2639] and the 95% prediction interval is 78.2477 ± 2.5706 × 3.3157 = [69.7243, 86.7711].

    Example 2 — one predictor, cross-checked against the linear regression calculator

    Paste two columns — x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 6 — and the calculator runs a simple regression. The slope is 0.8 and the intercept is 1.8, so ŷ = 1.8 + 0.8x. The correlation is r = 0.8528, R² = 0.7273 and the slope’s p-value is 0.0663 (not significant at 5%). These match the linear regression calculator exactly, which is the point: multiple regression with one predictor is simple regression, explained in full in Linear Regression Explained.

    Edge cases

    • Perfect collinearity: if x2 is an exact multiple of x1 (for example x2 = 2x1), the normal equations have no unique solution. The calculator shows an error instead of NaN — drop or combine a predictor.
    • Too few rows: a two-predictor model needs at least 4 observations (one per coefficient plus one for the residual variance). With fewer, the calculator asks for more data.
    • One predictor: paste two columns and the calculator fits a simple regression, with the correlation r shown and the VIF tiles replaced by a dash (VIF needs at least two predictors).
    • Small samples: with n = 8 and two predictors there are only 5 residual degrees of freedom, so the intervals are wide and the t-tests have little power. The example’s non-significant hours coefficient is partly a small-sample story.

    Frequently asked questions

    How do I read a coefficient?

    A coefficient is the change in the outcome for a one-unit increase in that predictor, holding the other predictor constant. β₂ = 7.1631 means one extra practice test is associated with 7.16 extra exam marks for students who studied the same number of hours. The intercept is the predicted outcome when all predictors are zero — often outside the data range, so read it as an anchor rather than a real case. Check the p-value next to each coefficient: it tests whether that coefficient is zero.

    What is VIF?

    The variance inflation factor measures how much a predictor’s standard error is inflated by its correlation with the other predictors: VIF = 1 / (1 − R²ₗ), where R²ₗ comes from regressing that predictor on the others. VIF = 1 means no correlation. Above 5 is a worry, above 10 is serious — the coefficients become unstable. Here VIF = 3.5862, moderate, and it explains why hours studied loses significance once practice tests are included.

    Why is my predictor not significant?

    Usually because it shares its explanatory power with another predictor. In the worked example, hours studied correlates with practice tests at r = 0.8492, so once practice tests are in the model, hours studied adds almost nothing new (p = 0.6345) — even though it looks important on its own. Other causes: a genuinely small effect, a small sample (only 5 residual degrees of freedom here), or a noisy outcome. Check the VIF first, then consider whether the predictor is really needed, or whether you need more data.

    Sources: the formulas on this page are the standard least-squares results for multiple regression. All worked examples were recomputed with Python (numpy.linalg.lstsq and scipy.stats). Last updated 19 November 2026.

    See all 91 free statistics tools on Empirical Rule Calculators.