author: Kathryn Alexander date: 2/17/20 autosize: true
What was the stopping distance of cars in the 1920’s?
A linear model is used to predict the car stopping distance (in feet) based on the car speed (in mph). A speed of 20 mph results in a stopping distance of 61.06908 feet.
data(cars)
model1 <- lm(dist ~ speed, data = cars)
model1pred <- predict(model1, newdata = data.frame(speed = 20))
model1pred
1
61.06908
Here is a plot of the data and the linear model that was fit to it. The example of 20 mph is highlighted with a red data point larger than the other data.
plot of chunk unnamed-chunk-2
Try out the Shiny App to explore the stoppping distance of cars in the 1920’s