Exercises: linear models

  1. Make another graph identical to the final one here, using lines() instead of points().

  1. The cost of a home depends on the number of bedrooms in the house. Suppose the following data is recorded for homes in a given town.
price <- c(80, 151.4, 310, 295, 339, 337.5, 228.7, 
    245, 339, 43, 279, 599, 119, 289, 249, 178, 159, 289, 488, 376, 
    249, 275, 275, 459, 219, 359, 379, 189, 173), sale = c(117.7, 
    151, 300, 275, 340, 337.5, 215, 239, 345, 48, 262.5, 613, 119, 
    305, 249, 170, 153, 291, 450, 370, 245, 275, 272.5, 459, 230, 
    360, 370, 185, 185), 

bedrooms <- c(3, 4, 4, 4, 3, 4, 3, 3, 3, 
    1, 3, 4, 3, 3, 2, 3, 2, 3, 3, 3, 3, 4, 2, 5, 3, 3, 4, 4, 3),

  1. It is well known that the more beer you drink, the more your blood alcohol level rises. Suppose we have the following data on student beer consumption.
Student <- c( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Beers <- c(5, 2, 9, 8, 3, 7, 3, 5, 3, 5)
BAL <- c(0.10, 0.03, 0.19, 0.12, 0.04, 0.095, 0.07, 0.06, 0.02, 0.05)

  1. The lapse rate is the rate at which temperature drops as you increase elevation. Some hardy students were interested in checking empirically if the lapse rate of 9.8 degrees C/km was accurate for their hiking. To investigate, they grabbed their thermometers and their wrist altimeters and found the following data on their hike. Import the following data.

elevation (ft) 600 1000 1250 1600 1800 2100 2500 2900

temperature (F) 56 54 56 50 47 49 47 45