Home Â» Multiple Linear Regression by Hand (Step-by-Step)

# Multiple Linear Regression by Hand (Step-by-Step)

Multiple linear regression is a method we can use to quantify the relationship between two or more predictor variables and a response variable.

This tutorial explains how to perform multiple linear regression by hand.

### Example: Multiple Linear Regression by Hand

Suppose we have the following dataset with one response variableÂ y and two predictor variables X1 and X2:

Use the following steps to fit a multiple linear regression model to this dataset.

Step 1: Calculate X12, X22, X1y, X2y and X1X2.

Step 2: Calculate Regression Sums.

Next, make the following regression sum calculations:

• Î£x12 = Î£X12 â€“ (Î£X1)2 / n = 38,767 â€“ (555)2 / 8 =Â 263.875
• Î£x22 = Î£X22 â€“ (Î£X2)2 / n = 2,823 â€“ (145)2 / 8 =Â 194.875
• Î£x1y = Î£X1y â€“ (Î£X1Î£y) / n = 101,895 â€“ (555*1,452) / 8 = 1,162.5
• Î£x2y = Î£X2y â€“ (Î£X2Î£y) / n = 25,364 â€“ (145*1,452) / 8 = -953.5
• Î£x1x2 = Î£X1X2 â€“ (Î£X1Î£X2) / n = 9,859 â€“ (555*145) / 8 = -200.375

Step 3: CalculateÂ b0, b1, and b2.

The formula to calculate b1 is: [(Î£x22)(Î£x1y)Â  â€“ (Î£x1x2)(Î£x2y)]Â  / [(Î£x12) (Î£x22) â€“ (Î£x1x2)2]

Thus, b1 = [(194.875)(1162.5)Â  â€“ (-200.375)(-953.5)]Â  / [(263.875) (194.875) â€“ (-200.375)2] =Â 3.148

The formula to calculate b2 is: [(Î£x12)(Î£x2y)Â  â€“ (Î£x1x2)(Î£x1y)]Â  / [(Î£x12) (Î£x22) â€“ (Î£x1x2)2]

Thus, b2 = [(263.875)(-953.5)Â  â€“ (-200.375)(1152.5)]Â  / [(263.875) (194.875) â€“ (-200.375)2] =Â -1.656

The formula to calculate b0 is: y â€“ b1X1Â â€“ b2X2

Thus, b0 = 181.5 â€“ 3.148(69.375) â€“ (-1.656)(18.125) =Â -6.867

Step 5: Place b0, b1, and b2Â in the estimated linear regression equation.

The estimated linear regression equation is:Â Å· =Â b0 + b1*x1 + b2*x2

In our example, it isÂ Å· = -6.867 + 3.148x1 â€“ 1.656x2

### How to Interpret a Multiple Linear Regression Equation

Here is how to interpret this estimated linear regression equation: Å· = -6.867 + 3.148x1 â€“ 1.656x2

b0 = -6.867. When both predictor variables are equal to zero, the mean value for y is -6.867.

b1Â = 3.148. A one unit increase in x1 is associated with a 3.148 unit increase in y, on average, assuming x2 is held constant.

b2 = -1.656. A one unit increase in x2 is associated with a 1.656 unit decrease in y, on average, assuming x1 is held constant.