0% found this document useful (0 votes)
92 views3 pages

Multiple Linear Regression Example

Uploaded by

Kunal k
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views3 pages

Multiple Linear Regression Example

Uploaded by

Kunal k
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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.

Common questions

Powered by AI

The calculations of coefficients in a multiple linear regression model rely on several assumptions: linearity, homoscedasticity, independence, and normality. These assumptions ensure the validity of the coefficients' estimates. Linearity assumes that the relationship between variables is linear, homoscedasticity implies constant variance of errors, independence assumes non-correlated residuals, and normality ensures residuals follow a normal distribution. Violating these assumptions can lead to biased or inconsistent coefficient estimates .

The step-by-step method for performing multiple linear regression by hand is essential for educational purposes, allowing learners to grasp the fundamental process and calculations. However, in practical terms, it is labor-intensive and prone to human error, making it less feasible for large datasets. Nowadays, computer software is preferred for its efficiency and accuracy in handling complex calculations and large-scale data, which are crucial for practical applications .

The coefficient b1 is calculated as [(Σx2^2)(Σx1y) – (Σx1x2)(Σx2y)] / [(Σx1^2)(Σx2^2) – (Σx1x2)^2]. For b2, the formula is: [(Σx1^2)(Σx2y) – (Σx1x2)(Σx1y)] / [(Σx1^2)(Σx2^2) – (Σx1x2)^2]. The intercept b0 is determined using the formula b0 = y - b1X1 - b2X2, where these calculations rely on each variable's summations and averages across the dataset .

The intercept b0 in a multiple linear regression equation represents the estimated mean value of the response variable y when both predictor variables are equal to zero. In the provided example, b0 = -6.867, indicating that when X1 and X2 are zero, y is estimated to be -6.867 .

Interpretation of a multiple linear regression equation involves understanding the meaning of the intercept and each coefficient. For the equation ŷ = -6.867 + 3.148x1 - 1.656x2, the intercept -6.867 represents the expected value of y when x1 and x2 are zero. The coefficient 3.148 implies that for each unit increase in x1, y increases by 3.148 units, assuming x2 is constant. Conversely, -1.656 indicates that for each unit increase in x2, y decreases by 1.656 units, assuming x1 is constant .

Once you have calculated the coefficients b0, b1, and b2 using their respective formulas, insert them into the multiple linear regression equation format: ŷ = b0 + b1*x1 + b2*x2. For instance, with b0 = -6.867, b1 = 3.148, and b2 = -1.656, the equation becomes ŷ = -6.867 + 3.148x1 - 1.656x2, representing the estimated relationship between the predictors and the response variable .

In a multiple linear regression model, b1 represents the change in the response variable y for a one-unit increase in the predictor variable x1, assuming x2 is held constant. Similarly, b2 denotes the change in y for a one-unit increase in x2, with x1 held constant. For the given coefficients, b1 = 3.148 indicates that y increases by 3.148 units for a unit increase in x1, and b2 = -1.656 implies that y decreases by 1.656 units for a unit increase in x2 .

The summation equations such as Σx1^2, Σx2^2, Σx1y, Σx2y, and Σx1x2 provide insights into how predictor variables individually, and in combination, influence the response variable. By calculating these sums, one can assess the variance and covariances among variables, which helps in understanding the strength and nature of the relationships, ultimately improving the predictive accuracy of the regression model by allowing it to precisely adjust for each predictor's contribution .

Performing calculations like Σx1^2, Σx2^2, and Σx1y is crucial in multiple linear regression because they are used to determine the variance and covariance of predictor variables, which are essential for calculating the regression coefficients (b1, b2, and b0). These values help quantify the relationship between predictor variables and the response variable, enabling model estimations and interpretations .

To fit a multiple linear regression model by hand, follow these steps: calculate the squares of the predictor variables (X1^2, X2^2) and their cross-products and products with the response variable (X1y, X2y, X1X2). Next, compute regression sums such as Σx1^2, Σx2^2, Σx1y, Σx2y, and Σx1x2 by normalizing the sums. These calculations will be used to determine the regression coefficients b1 and b2 through their respective formulas. Finally, calculate b0 using the formula b0 = y - b1X1 - b2X2, and construct the regression equation ŷ = b0 + b1*x1 + b2*x2 .

You might also like