Page 168 - Applied Statistics with R
P. 168

168                   CHAPTER 9. MULTIPLE LINEAR REGRESSION







                                       82
                                                                                            X
                                       80
                                       78

                                   year  76                           X

                                       74
                                       72

                                       70

                                        1500    2000   2500   3000   3500    4000   4500   5000

                                                                     wt



                                 However, we have to consider weight and year together now. And based on the
                                 above plot, one of the new cars is within the “blob” of observed values, while
                                 the other, the car from 1981 weighing 5000 pounds, is noticeably outside of the
                                 observed values. This is a hidden extrapolation which you should be aware of
                                 when using multiple regression.
                                 Shifting gears back to the new data pair that can be reasonably estimated, we
                                 do a quick verification of some of the mathematics in R.

                                 x0 = c(1, 3500, 76)
                                 x0 %*% beta_hat



                                 ##           [,1]
                                 ## [1,] 20.00684




                                                                     1
                                                                   ⎡
                                                                 = 3500 ⎤
                                                                   ⎢
                                                                        ⎥
                                                               0
                                                                   ⎣ 76 ⎦
                                                                −14.6376419
                                                            ̂
                                                              =  ⎡  −0.0066349  ⎤
                                                                           ⎥
                                                               ⎢
                                                               ⎣ 0.761402 ⎦
   163   164   165   166   167   168   169   170   171   172   173