Multiple Linear Regression Calculator

Read the Theory Guide →

Enter numeric features and their target values, choose values for the features you want to predict, and calculate a multiple linear regression model. The solver walks through the Normal Equation, shows the intercept and feature weights, and then uses them to calculate the predicted value.

What You Can Explore

  • Edit the numeric feature values and target values in the table, and add or remove rows or feature columns.
  • Set a value for every feature in the Target row to choose the case you want to predict.
  • Press Calculate Regression Weights to work through the matrix calculation and obtain the intercept and one weight for each feature.
  • Follow the final equation as the solver substitutes your Target values to produce the predicted value.
Core Mechanics
▼
  • Beyond the 2D Line: While simple regression fits a line, multiple regression fits a *hyperplane* across all your features. The core logic remains: it’s just a weighted sum of all your inputs plus a baseline intercept.
  • The "Holding Constant" Rule: This is crucial for exams! Each coefficient βj\beta_j represents the change in y^\hat{y} for a one-unit increase in xjx_j, *assuming all other features remain fixed*.
  • Beware Multicollinearity: If your input features are strongly correlated with each other, the model gets "confused." The predictions might still be accurate, but your coefficients become unstable, making it impossible to interpret which feature is actually driving the result.
  • Dimensionality Expansion: Just because you can’t visualize a 5-dimensional hyperplane doesn’t mean the math changes! The model still finds the optimal "fit" by minimizing errors across every dimension simultaneously, exactly like it did in 2D.
Initializing Workspace...

Understanding Your Result

The weights and prediction come from the data and Target values you entered. The solver first builds the feature matrix with an intercept column, then works through the Normal Equation to calculate the coefficients. Those coefficients are finally used in the fitted equation to predict the target.

  • Step 6 gives the intercept and one weight for each feature. A feature's weight tells you how the predicted target changes for a one-unit increase in that feature when the other features are kept fixed.
  • The first column of X contains 1s. It gives the model a separate intercept term, so the fitted equation can have a constant value in addition to the feature weights.
  • Steps 2 to 5 build the matrices needed by the Normal Equation. If the required inverse does not exist, the solver cannot calculate a unique set of regression weights.
  • The Target row is used only for the final prediction. Changing it changes the predicted value, but it does not change the fitted weights because the training data has not changed.

Try These Experiments

Move the Target Point

Setup: Run the preloaded data with the Target values X1 = 1.5 and X2 = 3. Step 6 gives an intercept of −2, a weight of 2.5 for X1, a weight of 0.5 for X2, and a prediction of 3.25.

Action: Change the Target X1 from 1.5 to 3, keep X2 at 3, and press Calculate Regression Weights again.

What to Observe: The intercept and both feature weights stay exactly the same. The prediction changes from 3.25 to 7 because X1 increased by 1.5 and its weight is 2.5.

Takeaway: The Target row does not retrain the model. It only asks the existing equation for a prediction at a different point. Moving one feature changes the prediction according to that feature's weight while the other features stay fixed.

Add a Point That Fits the Model

Setup: Run the preloaded data. The fitted equation is Y = −2 + 2.5X1 + 0.5X2, and all three original rows lie exactly on this equation.

Action: Add a fourth row with X1 = 4, X2 = 5, and Y = 10.5, then calculate again.

What to Observe: The new row increases the size of the matrices, but the intercept and feature weights remain −2, 2.5, and 0.5. The prediction at the Target values also remains 3.25.

Takeaway: A new training row that already agrees with the fitted equation does not need the model to move. If you change that row's target to a different value, the model has to adjust its weights to balance the new row with the rest of the data.

Make Two Features Redundant

Setup: Start with the original data, where X1 and X2 contain different information and the regression calculation works normally.

Action: Change the X2 values to 2, 4, and 6, so X2 is exactly twice X1 in every row, then press Calculate Regression Weights.

What to Observe: The regression results disappear and the solver reports a matrix error instead of producing weights. X2 now contains exactly the same information as X1, just multiplied by 2.

Takeaway: When one feature can be written exactly from another feature, there is no unique way to separate their individual effects. The feature columns become linearly dependent, so XᵀX cannot be inverted and the Normal Equation cannot produce a unique set of weights.