OBJECTIVES:

  1. Learn How to Perform Multiple Linear Regression Using .
  2. Discuss Homework 1 (Part II) and Lab Assignments 1 and 2.

Example 1:

Multiple linear regression is used to model response variable with more than one regressor. Let’s consider the dataset “Rubber”, which contains three variables: abrasion loss, tensile strength, and hardness. The goal is to use tensile strength and hardness to predict abrasion loss. Thus, the abrasion loss is response and tensile strength and hardness are predictors.

  1. Plot the data using a scatterplot array and inspect pairwise association.
#install.packages("MASS")
library(MASS)
pairs(Rubber)

In view of the scatterplot array, the following MLR model is considered: \[\begin{equation} loss=\beta_0 + \beta_1 \times hard + \beta_2 \times tens + \epsilon, \quad \epsilon \sim N(0, \sigma^2). \end{equation}\]

  1. Run multiple linear regression: ‘loss’ is the response and tensile strength and hardness are regressors.
mlrfit <- lm(loss ~ hard + tens, data=Rubber)
summary(mlrfit)
## 
## Call:
## lm(formula = loss ~ hard + tens, data = Rubber)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -79.385 -14.608   3.816  19.755  65.981 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 885.1611    61.7516  14.334 3.84e-14 ***
## hard         -6.5708     0.5832 -11.267 1.03e-11 ***
## tens         -1.3743     0.1943  -7.073 1.32e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 36.49 on 27 degrees of freedom
## Multiple R-squared:  0.8402, Adjusted R-squared:  0.8284 
## F-statistic:    71 on 2 and 27 DF,  p-value: 1.767e-11

\(\beta_0\) is estimated as 885.1611 with standard error 61.7516;

\(\beta_1\) is estimated as-6.5708 with standard error 0.5832;

\(\beta_2\) is estimated as -1.3743 with standard error 0.1943;

And \(\sigma\) is estimated as 36.49.

Thus, the fitted model is written as: \[\hat loss=885.1611-6.5708 \times hard - 1.3743 \times tens\]

Questions:

  1. What is the p-value of the two-sided test for \(H_0: \beta_0=0\) vs \(H_a: \beta_0\neq0\)? The p-value of the two-sided test for beta0 is 3.84e-14. Therefore we have very strong evidence against the null hypothesis.
  2. What is the p-value of the two-sided test for \(H_0: \beta_1=0\) vs \(H_a: \beta_1\neq0\)? The p-value of the two-sided test for beta1 is 1.03e-11. Therefore we have very strong evidence against the null hypothesis.
  3. What is the p-value of the two-sided test for \(H_0: \beta_2=0\) vs \(H_a: \beta_2\neq0\)? The p-value of the two-sided test for beta1 is 1.32e-07. Therefore we have very strong evidence against the null hypothesis. The \(p\)-values for hard and tens are less than 0.05, implying the significant effect of these two variables on ‘loss’.

Below are the 95% confidence intervals for regression coefficients: \(\beta_0, \beta_1,\) and \(\beta_2\):

confint(mlrfit,level=0.95) 
##                  2.5 %       97.5 %
## (Intercept) 758.457323 1011.8648954
## hard         -7.767432   -5.3742274
## tens         -1.773001   -0.9756228

Assignment

  1. Repeat the steps in Example 1 by trying an appropriate transformation of the variables ‘loss’, ‘hard’ or ‘tens’. \begin{enumerate}
#install.packages("MASS")
library(MASS)
Rubber_trans = Rubber
Rubber_trans$hard_trans = log(Rubber_trans$hard)
Rubber_trans = Rubber_trans[,c(1,3,4)]
pairs(Rubber_trans)

Rubber_trans <- lm(loss ~ log(hard) + tens, data=Rubber)
summary(Rubber_trans)
## 
## Call:
## lm(formula = loss ~ log(hard) + tens, data = Rubber)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -86.533 -19.078   1.125  19.531  73.678 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 2240.6118   185.7471  12.063 2.20e-12 ***
## log(hard)   -432.6118    40.7408 -10.619 3.86e-11 ***
## tens          -1.2868     0.2018  -6.377 7.89e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 38.3 on 27 degrees of freedom
## Multiple R-squared:  0.824,  Adjusted R-squared:  0.811 
## F-statistic: 63.21 on 2 and 27 DF,  p-value: 6.519e-11
confint(Rubber_trans,level=0.90) 
##                     5 %        95 %
## (Intercept) 1924.230916 2556.992633
## log(hard)   -502.005133 -363.218493
## tens          -1.630533   -0.943085

β0 is estimated as 2240.6118 with standard error 185.7471; β1 is estimated as -432.6118 with standard error 40.7408; β2 is estimated as -1.2868 with standard error 0.2018; And σ is estimated as 38.3. Thus, the fitted model is written as: ˆloss = 2240.6118 -432.6118 × log(hard) − 1.3743 × tens Questions: (i) What is the p-value of the two-sided test for H0 : β0 = 0 vs Ha : β0 6 = 0? The p-value of the two-sided test for beta0 is 2.20e-12. Therefore we have very strong evidence against the null hypothesis. (ii) What is the p-value of the two-sided test for H0 : β1 = 0 vs Ha : β1 6 = 0? The p-value of the two-sided test for beta1 is 3.86e-11. Therefore we have very strong evidence against the null hypothesis. (iii) What is the p-value of the two-sided test for H0 : β2 = 0 vs Ha : β2 6 = 0? The p-value of the two-sided test for beta2 is 7.89e-07. Therefore we have very strong evidence against the null hypothesis. The p-values for hard and tens are less than 0.05, implying the significant effect of these two variables on ‘loss’. 5 % 95 % (Intercept) 1924.230916 2556.992633 log(hard) -502.005133 -363.218493 tens -1.630533 -0.943085

Display the transformed data using a scatterplot array, and specify a multiple linear regression model for predicting (transformed) loss from the predictors ‘hard’ and ‘tens’. Run the regression in R, and report the Summary of the model. Write down the fitted model.

Report the 90% confidence intervals for regression coefficients. \end{enumerate}