R Documentation Motor Trend Car Road Tests 1) Description The data was extracted
ID: 3309341 • Letter: R
Question
R Documentation Motor Trend Car Road Tests
1) Description The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models).
Format
A data frame with 32 observations on 11 variables
. [, 1] mpg Miles/(US) gallon
[, 2] cyl Number of cylinders
[, 3] disp Displacement (cu.in.)
[, 4] hp Gross horsepower
[, 5] drat Rear axle ratio
[, 6] wt Weight (1000 lbs)
[, 7] qsec 1/4 mile time
[, 8] vs V/S
[, 9] am Transmission (0 = automatic, 1 = manual)
[,10] gear Number of forward gears
[,11] carb Number of carburetors
Source Henderson and Velleman (1981), Building multiple regression models interactively. Biometrics, 37, 391–411. summary(mtcars)
## mpg cyl disp hp drat
## Min. :10.40 4:11 Min. : 71.1 Min. : 52.0 Min. :2.760
## 1st Qu.:15.43 6: 7 1st Qu.:120.8 1st Qu.: 96.5 1st Qu.:3.080
## Median :19.20 8:14 Median :196.3 Median :123.0 Median :3.695
## Mean :20.09 Mean :230.7 Mean :146.7 Mean :3.597
## 3rd Qu.:22.80 3rd Qu.:326.0 3rd Qu.:180.0 3rd Qu.:3.920
## Max. :33.90 Max. :472.0 Max. :335.0 Max. :4.930
## wt qsec vs am gear carb
## Min. :1.513 Min. :14.50 0:18 0:19 3:15 Min. :1.000
## 1st Qu.:2.581 1st Qu.:16.89 1:14 1:13 4:12 1st Qu.:2.000
## Median :3.325 Median :17.71 5: 5 Median :2.000
## Mean :3.217 Mean :17.85 Mean :2.812
## 3rd Qu.:3.610 3rd Qu.:18.90 3rd Qu.:4.000
## Max. :5.424 Max. :22.90 Max. :8.000
2) Miles per gallon and number of gears
## Analysis of Variance Table
##
## Response: var1
## Df Sum Sq Mean Sq F value Pr(>F)
## var2 2 483.24 241.622 10.901 0.0002948 ***
## Residuals 29 642.80 22.166
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = var1 ~ var2)
##
## $var2
## diff lwr upr p adj
## 4-3 8.426667 3.9234704 12.929863 0.0002088
## 5-3 5.273333 -0.7309284 11.277595 0.0937176
## 5-4 -3.153333 -9.3423846 3.035718 0.4295874
3) Miles per gallon and number of cylinders in engine
## Analysis of Variance Table
##
## Response: var1
## Df Sum Sq Mean Sq F value Pr(>F)
## var2 2 824.78 412.39 39.697 4.979e-09 ***
## Residuals 29 301.26 10.39
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = var1 ~ var2)
##
## $var2
## diff lwr upr p adj
## 6-4 -6.920779 -10.769350 -3.0722086 0.0003424
## 8-4 -11.563636 -14.770779 -8.3564942 0.0000000
## 8-6 -4.642857 -8.327583 -0.9581313 0.0112287
4) Weight of car and number of gears in engine
## Analysis of Variance Table
##
## Response: var1
## Df Sum Sq Mean Sq F value Pr(>F)
## var2 2 12.879 6.4395 11.116 0.0002609 ***
## Residuals 29 16.800 0.5793
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = var1 ~ var2)
##
## $var2
## diff lwr upr p adj
## 4-3 -1.27593333 -2.0039372 -0.5479295 0.0004657
## 5-3 -1.26000000 -2.2306718 -0.2893282 0.0088999
## 5-4 0.01593333 -0.9846122 1.0164789 0.9991476
5) Weight of car and number of cylinders in engine
## Analysis of Variance Table
##
## Response: var1
## Df Sum Sq Mean Sq F value Pr(>F)
## var2 2 18.176 9.0879 22 .911 1.075e-06 ***
## Residuals 29 11.503 0.3967
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## ## Fit: aov(formula = var1 ~ var2)
##
## $var2
## diff lwr upr p adj
## 6-4 0.8314156 0.07939155 1.583440 0.0278777
## 8-4 1.7134870 1.08680032 2.340174 0.0000006
## 8-6 0.8820714 0.16206323 1.602080 0.0138630
1. Suppose we want to understand how the number of gears in an engine affects miles per gallon for the car.
a) What are the explanatory and response variable?
b) How many total observations are there?
c) How many groups are we comparing?
d) What are the null and alternate hypotheses for an ANOVA test addressing this research question?
e) What are the test statistic and p-value for the ANOVA test?
f) What do we conclude from the ANOVA test?
g) How many pairwise comparisons are we doing in the Tukey HSD?
h) What are the p-values of the Tukey HSD tests?
i) What do we conclude from the Tukey HSD pairwise tests?
2. Suppose we want to understand how the number of cylinders in an engine affects miles per gallon for the car.
a) What are the null and alternate hypotheses for an ANOVA test addressing this research question?
b) What are the test statistic and p-value for the ANOVA test?
c) What do we conclude from the ANOVA test?
d) What are the p-values of the Tukey HSD tests?
e) What do we conclude from the Tukey HSD pairwise tests?
3. Suppose we want to understand how the number of gears in an engine affects the weight of the car.
a) Describe the variables we are interested in.
b) Set up, and report the results of, an ANOVA test.
c) Based on the ANOVA and pairwise tests, what can we conclude?
4. Suppose we want to understand how the number of cylinders in an engine affects the weight of the car. Describe this study. What do you conclude, and why?
Explanation / Answer
1. Suppose we want to understand how the number of gears in an engine affects miles per gallon for the car.
a) What are the explanatory and response variable?
response variable is the miles per gallon
explanatory variable is the number of gears
b) How many total observations are there?
we see that the total df is 29+2 = 31
so we know that df = n-1
so n = df +1 = 32 , there are 32 observation in total
c) How many groups are we comparing?
there are 3 groups
3 gears
4 gears
5 gears
d) What are the null and alternate hypotheses for an ANOVA test addressing this research question?
H0 : There is no significant difference in the average MPG of the 3 groups
H1 : There is significant difference in the average MPG of the 3 groups , atleast for 2 groups
e) What are the test statistic and p-value for the ANOVA test?
Consider this table below
2) Miles per gallon and number of gears
## Analysis of Variance Table
##
## Response: var1
## Df Sum Sq Mean Sq F value Pr(>F)
## var2 2 483.24 241.622 10.901 0.0002948 ***
## Residuals 29 642.80 22.166
so the f stat os 10.901
and p value is 0.0002948
f) What do we conclude from the ANOVA test?
as the p value is less than 0.05 , hence we reject the null hypothesis in favor of alternate hypothesis to conclude that There is significant difference in the average MPG of the 3 groups , atleast for 2 groups
g) How many pairwise comparisons are we doing in the Tukey HSD?
## Fit: aov(formula = var1 ~ var2)
##
## $var2
## diff lwr upr p adj
## 4-3 8.426667 3.9234704 12.929863 0.0002088
## 5-3 5.273333 -0.7309284 11.277595 0.0937176
## 5-4 -3.153333 -9.3423846 3.035718 0.4295874
we see the pairwise comparisons for Tukey HSD
h) What are the p-values of the Tukey HSD tests?
The p values are
0.0002088 ## signficant as the p value is less than 0.05
0.0937176 ## not signficant as the p value is not less than 0.05
0.4295874 ## not signficant as the p value is not less than 0.05
i) What do we conclude from the Tukey HSD pairwise tests?
we can say that only the group pair 4-3 is statistically signficant as the p value is less than 0.05 , hence we can conclude that the MPG values for 4-3 gears are signficantly different
Please note that we can answer only 1 question , with 4 subaprts at a time as per the answering guidelines. I have answered the 1st question for you completely
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.