Lesson 10 Simple Linear Regression and Correlation
Lesson 10 Simple Linear Regression and Correlation
1
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
Applied Statistics and
Probability for Engineers
Sixth Edition
Douglas C. Montgomery George C. Runger
Chapter 12
Multiple Linear Regression
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
12-1.1 Introduction
• Many applications of regression analysis
involve situations in which there are more than
one regressor variable.
• A regression model that contains more than
one regressor variable is called a multiple
regression model.
yn xn1 xn2 x nk
Sec 12-1 Multiple Linear Regression Model 5
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
12-1.2 Least Squares Estimation of the Parameters
• The least squares function is given by
2
n n k
L = i2 = y −b − b j xij
i 0
(12-2)
i =1 i =1 j =1
• The least squares estimates must satisfy
L n k
=−2 y − bˆ − bˆ x = 0
0 j ij
(12-3)
b0 bˆ i
ˆ
0 , b1 ,, b k
ˆ i =1 j = 1
and
L n k
=−2 y − bˆ − bˆ x x = 0
i 0
j = 1, 2, , k (12-4)
b j
j ij ij
bˆ 0 , bˆ 1 ,, bˆ k i =1 j =1
Sec 12-1 Multiple Linear Regression Model 6
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
12-1.2 Least Squares Estimation of the Parameters
Figure 12-4 Matrix of computer-generated scatter plots for the wire bond
pull strength data in Table 12-2.
Sec 12-1 Multiple Linear Regression Model 10
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
Example 12-1
Specifically, we will fit the multiple linear regression model
Y= b0 + b1x1 + b2x 2 +
where Y = pull strength, x1 = wire length, and x2 = die height. From the
data in Table 12-2 we calculate
25 25 25
n = 25, yi = 725.82, xi1 = 206, xi 2 = 8, 294
i =1 i =1 i =1
25 25 25
i =1
x = 2, 396,
2
i1 x
i =1
2
i2 = 3, 531,848, xi1 xi 2 = 77,177
i =1
25 25
i =1
xi1 yi = 8, 008.47, xi 2 yi = 274,816.71
i =1
Click
Regression
y = Xb + (12-6)
where
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
12-1.3 Matrix Approach to Multiple Linear Regression
The fitted regression model is
k
yˆi = bˆ 0 + bˆ j xij i = 1, 2, , n (12-8)
j =1
e = y − yˆ (12-9)
y = b0 + b1x1 + b2x2 +
b̂ = (XX) −1 Xy
Sec 12-1 Multiple Linear Regression Model 24
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
Example 12-2
bˆ 0 25 −1
8, 294 725.82
or
206
bˆ 1 = 206 2,396 77,177 8,008.37
ˆ 8, 294 77,177 3,531,848 274,811.31
b2
0.214653 −0.007491 −0.000340 725.82
= −0.007491 0.001671 −0.000019 8,008.47
−0.000340 −0.000019 +0.0000015 274,811.31
2.26379143
= 2.74426964
0.01252781
Table 12-3 displays all 25 fitted values and the corresponding residuals. The
fitted values and residuals are calculated to the same accuracy as the original
data.
Sec 12-1 Multiple Linear Regression Model 26
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
Example 12-2
Table 12-3 Observations, Fitted Values, and Residuals for Example 12-2
Observation Observation
Number yi ŷi ei = yi − yˆi Number yi ŷi ei = yi − yˆi
1 9.95 8.38 1.57 14 11.66 12.26 –0.60
2 24.45 25.60 –1.15 15 21.65 15.81 5.84
3 31.75 33.95 –2.20 16 17.89 18.25 –0.36
4 35.00 36.60 –1.60 17 69.00 64.67 4.33
5 25.02 27.91 –2.89 18 10.30 12.34 –2.04
6 16.86 15.75 1.11 19 34.93 36.47 –1.54
7 14.38 12.45 1.93 20 46.59 46.56 0.03
8 9.60 8.40 1.20 21 44.88 47.06 –2.18
9 24.35 28.21 –3.86 22 54.12 52.56 1.56
10 27.50 27.98 –0.48 23 56.63 56.31 0.32
11 17.08 18.40 –1.32 24 22.13 19.98 2.15
12 37.00 37.46 –0.46 25 21.15 21.00 0.15
13 41.95 41.46 0.49
Analysis of Variance
Source DF SS MS F P
Regression 2 5990.8 2995.4 572.17 0.000
Residual Error 22 115.2 5.2 ̂ 2
Total 24 6105.9
Source DF Seq SS
Length 1 5885.9
Height 1 104.9
An unbiased estimator of 2 is
n
i
e 2
SS E
ˆ2 = i =1= (1210)
n− p n− p
Unbiased estimators:
E (bˆ ) = E (XX )−1 XY
= E (XX ) −1
X(Xb + )
= E (XX ) −1
XXb + (XX )−1 X
=b
Covariance Matrix:
C00 C01 C02
C = ( XX) −1 = C10 C11 C12
C20 C21 C22
Sec 12-1 Multiple Linear Regression Model 30
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-1: Multiple Linear Regression Model
12-1.4 Properties of the Least Squares Estimators
V (bˆ j ) = 2 C jj , j = 0, 1, 2
cov(bˆ i , bˆ j ) = 2 Cij , i j
In general,
ˆ −1
2
cov(b ) = ( X X) = C
2
2
n
yi
(725.82) 2
SST = y y − i =1
= 27,178.5316 −
n 25
= 6105.9447
Example 12-3
and by subtraction
SS E = SST − SS R = y y − b X y = 115.1716
Since f0 > f0.05,2,22= 3.44 (or since the Pvalue is considerably smaller than
= 0.05), we reject the null hypothesis and conclude that pull strength is
linearly related to either wire length or die height, or both.
Example 12-3
Table 1210 Test for Significance of' Regression for Example 12-3
R2 and Adjusted R2
The coefficient of multiple determination
SS R SS E
R = 2
=1− (1213)
SST SST
R2 and Adjusted R2
The adjusted R2 is
SS E / (n − p )
2
Radj =1− (1214)
SST / (n − 1)
H0: bj = bj0
H1: bj bj0 (12-15)
ˆ −b
b ˆ −b
b
j j0 j j0
T0 = = (12-16)
ˆ )
se(b
2C jj j
H0: b2 = 0
H1: b2 0
bˆ 0.01253
t0 = = = 4.477
ˆ 2C22 (5.2352)(0.0000015)
y = Xb +
b1
b=
b 2
H0: b1 = 0
H1: b1 0 (12-17)
y = X2b2 + (12-19)
SS R (b1 | b 2 )/r
F0 = (12-21)
MS E
H 0: b3 = b4 = 0 H1: b3 0 or b4 0
To test this hypothesis, we need the extra sum of squares due to b3 and
b4 or
SSR(b4, b3 b2, b1, b0) = SSR (b4, b3, b2, b1, b0) − SSR(b2, b1, b0)
= SSR(b4, b3, b2, b1b0) − SSR (b2, b1b0)
Example 12-6
In Example 12-3 we calculated
2
n
yi
SS R (b2 , b1 |b0 ) = b X y − i =1 = 5990.7712 ( two degrees of freedom)
n
Also, Table 12-4 shows the Minitab output for the model with only x1 and x2 as predictors. In
the analysis of variance table, we can see that SSR = 5990.8 and this agrees with our
calculation. In practice, the computer output would be used to obtain this sum of squares.
If we fit the model Y = b0 + b1x1 + b2x2 + b3x3 + b4x4, we can use the same matrix formula.
Alternatively, we can look at SSR from computer output for this model. The analysis of
variance table for this model is shown in Table 12-11 and we see that
Therefore,
SSR(b4, b3b2, b1, b0) = 6024.0 − 5990.8 = 33.2 (two degrees of freedom)
Note that MSE from the full model using x1, x2, x3 and x4 is used in the denominator of the
test statistic. Because f0.05, 2, 20 = 3.49, we reject H0 and conclude that at least one of the
new variables contributes significantly to the model. Further analysis and tests will be
needed to refine the model and determine if one or both of x3 and x4 are important.
The mystery of the new variables can now be explained. These are quadratic powers of the
original predictors wire length and wire height. That is, x3 = x12 and x4 = x22 . A test for
quadratic terms is a common use of partial F-tests. With this information and the original
data for x1 and x2, you can use computer software to reproduce these calculations. Multiple
regression allows models to be extended in such a simple manner that the real meaning of
x3 and x4 did not even enter into the test procedure. Polynomial models such as this are
discussed further in Section 12-6.
bˆ j − t/2, n − p
ˆ 2C jj b j bˆ j + t/2, n − p
ˆ 2C jj (12-22)
2.55029 b1 2.93825
Also, computer software such as Minitab can be used to help calculate this
confidence interval. From the regression output in Table 10-4,bˆ 1 = 2.74427 and the
standard error of bˆ 1 = 0.0935 . This standard error is the multiplier of the t-table
constant in the confidence interval. That is, 0.0935 = (5.2352)(0.001671) .
Consequently, all the numbers are available from the computer output to
construct the interval and this is the typical method used in practice.
Sec 12-3 Confidence Intervals in Multiple Linear Regression 52
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-3: Confidence Intervals in Multiple Linear Regression
ˆ
ˆ Y |x0 = x 0 b
(12-23)
( )
V ˆ Y | x0 = 2 x0 (XX )−1 x 0 (12-24)
Definition
For the multiple linear regression model, a 100(1 - )%
confidence interval on the mean response at the point
x01, x02, , x0k is
ˆ Y |x 0 − t /2,n− p ˆ 2 x0 ( X X) −1 x 0
(12-25)
Y |x 0 ˆ Y |x 0 + t /2,n− p ˆ 2 x0 ( X X) −1 x 0
The estimated mean response at this point is found from Equation 12-23
as
2.26379
ˆ Y |x0 = x 0bˆ = 1 8 275 2.74427 = 27.66
0.01253
which reduces to
26.66 Y | x 0 28.66
yˆ 0 = x0b̂
A 100(1-)% prediction interval for this future observation
is
Y0 yˆ 0 − t /2, n− p ˆ 2 (1 + x0 ( X X) −1 x 0 )
22.81 Y0 32.51
Notice that the prediction interval is wider than the confidence interval on
the mean response at the same point, calculated in Example 12-8. The
Minitab output in Table 12-4 also displays this prediction interval.
Sec 12-4 Prediction of New Observations 58
Copyright © 2014 John Wiley & Sons, Inc. All rights reserved.
12-5: Model Adequacy Checking
12-5.1 Residual Analysis
Example 12-10
The residuals for the model from Example 12-1 are shown in Table 12-3. A
normal probability plot of these residuals is shown in Fig. 12-6. No severe
deviations from normality are obviously apparent, although the two largest
residuals (e15 = 5.84 and e17 = 4.33) do not fall extremely close to a
straight line drawn through the remaining residuals.
ei
ri = i = 1, 2, , n (12-28)
ˆ 2 (1 − hii )
H = X(XX)-1X
Notice that the studentized residuals are larger than the corresponding
standardized residuals. However, the studentized residuals are still not so large
as to cause us serious concern about possible outliers.
ri2 hii
Di = i = 1, 2, , n (12-30)
p (1 − hii )