In: Statistics and Probability
A department of transportation's study on driving speeds and miles per gallon for midsize automobiles resulted in the following data: | ||||||||||||
Speed (MPH) | Miles per Gallon | |||||||||||
30 | 28 | |||||||||||
50 | 25 | |||||||||||
40 | 25 | |||||||||||
55 | 23 | |||||||||||
30 | 30 | |||||||||||
25 | 32 | |||||||||||
60 | 21 | |||||||||||
25 | 35 | |||||||||||
50 | 26 | |||||||||||
55 | 25 | |||||||||||
(a) Find the line of best fit | ||||||||||||
(b) Predict the mileage for a driving speed of 42 mph. | ||||||||||||
c) Compute and interprent the correlation coefficient. | ||||||||||||
(b) Is the relationship between speed and gas mileage statistically signficant? Provide support. |
a)Codes:
Import the data set into R and store in a data frame dat
summary(lm(dat$`Miles per Gallon`~dat$`Speed (MPH)`))
Output:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 39.01807 2.02017 19.314 5.36e-08 ***
dat$`Speed (MPH)` -0.28614 0.04598 -6.223 0.000253 ***
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.874 on 8 degrees of freedom
Multiple R-squared: 0.8288, Adjusted R-squared: 0.8074
F-statistic: 38.72 on 1 and 8 DF, p-value: 0.0002531
Result-
The regression model is given by Miles per Gallon=39.01807-0.28614*Speed(MPH)
b)The predicted value of Mileage for 42 MPH is 27.00019 Miles per Gallon
c)Correlation coefficient:
Code-cor(dat$`Speed (MPH)`,dat$`Miles per Gallon`)
Output:-0.9103694
Interpretation:Highly negatively correlated .Therefore,if the speed of automobiles increases the mileage decreases.
d)Since here the p value <0.05,hence the relationship between speed and gas mileage is statistically significant.