1 / 25

Regression

Regression. Several Explanatory Variables. Example: Scottish hill races data . These data are made available in R as > Library(MASS) > data(hills) They give record times (minutes) in 1984 of 35 Scottish hill races, against distance (miles) and total height climbed (feet).

gema
Download Presentation

Regression

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Regression Several Explanatory Variables

  2. Example: Scottish hill races data. These data are made available in R as > Library(MASS) > data(hills) They give record times (minutes) in 1984 of 35 Scottish hill races, against distance (miles) and total height climbed (feet).

  3. We regard time as the response variable, and seek to model how its conditional distribution depends on the explanatory variables distance and climb.

  4. The R code pairs(hills) produces the plots shown.

  5. These show that the response variable time has a strong positive association with each of the explanatory variables distance and climb - although a stronger dependence on distance. However, the two explanatory variables distance and climb also have a strong positive association with each other, and this complicates the modelling.

  6. Preliminary analysis of the data suggests that the observation (number 18) corresponding to Knock Hill is almost certainly in error - the time is much too great for the given distance and climb, and it may have been misrecorded by 1 hour. We therefore omit Knock Hill from the analysis. (use plot and identify commands)

  7. On physical grounds we attempt to find a model with zero intercept. We consider first a linear model (Model 1) involving both the explanatory variables distance and time. time = a x distance + b x climb + ε

  8. The fitted model is time = 5.47 x dist + 0.0106 x climb + ε

  9. The “three stars” associated with the estimates of the coefficients, shows that distance and climb are both important explanatory variables. (This can be confirmed by noting the very much poorer fits obtained if either of these variables is omitted).

  10. > plot(hills.model.1) produces

  11. The pattern of residuals leads us to suspect that there may be some nonlinear dependence on climb and/or distance. This would be physically quite natural. It here seems reasonable to introduce quadratic terms as a first attempt to model any nonlinearity.

  12. We consider now the (quite elaborate) model (Model2): time = a0 x distance + b0 x (distance)2 + c0 x climb + d0 x(climb)2 + ε

  13. The fitted model is now: time=5.62xdistance+0.0323x(distance)2+ 0.000262xclimb+0.00000180x(climb)2+ε

  14. The analysis, most notably “star values” associated with the estimate of the coefficient of (climb)2, shows that there is indeed evidence of nonlinearity in the dependence on climb, and (given also physical considerations) quite possibly in the dependence on distance.

  15. The pattern of residuals is now more randomly spread, indicating a better model than the fisrt one.

  16. Finally, the residuals of model 1 can be plotted against those of model 2.

  17. This suggests that Model 2 is a considerable improvement, at least insofar as it reduces the large residuals associated with the 3 labelled observations. The observations corresponding to Bens of Jura and Lairig Ghru remain moderately influential.

More Related