In 1974, Motortrend U.S. magazine did a road test for the miles per gallon, and 10 other design aspects of 32 cars, years 1973 - 1974. The 32 cars were both foreign imports, and domestically built. The 10 aspects other than miles per gallon, are number of cylinders, displacement (cubic inches), gross horsepower, rear axle ratio, weight (per 1000lbs), 1/4 mile time, engine (0 = V-shaped, 1 = straight), transmission (0 = automatic, 1 = manual), number of forward gears, and number of carburetors. The purpose of comparing this data will be to determine if manual, or automatic cars get more miles to the gallon, and which type of transmission has a quicker 1/4 mile time.This will be done by creating visual representations of the date, histograms and boxplots. [http://rpubs.com/priosSHHS/496238]
group <- cars$am
auto <- cars[which(group == "0"),]
man <- cars[which(group == "1"),]
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 15.00 21.00 22.80 24.39 30.40 33.90
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 10.40 14.95 17.30 17.15 19.20 24.40
When comparing automatic cars miles per gallon to manual cars, it is found that for higher gas mileage, a manual transmission is better. With a mean mpg of 24.39 for manual, and a mean mpg of 17.15 for automatic, there is quite a wide gap. As displayed in the graph, the maximum mpg of automatic cars recorded is 24.40, which is just .01 above the average for manual cars.In comparison, the maximum mpg for manual cars is 33.90.
Null hypothesis: There is no difference between the miles per gallon and type of transmission.
Alternate hypothesis: There is a difference between miles per gallon and type of transmission.
##
## Welch Two Sample t-test
##
## data: man$mpg and auto$mpg
## t = 3.7671, df = 18.332, p-value = 0.001374
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 3.209684 11.280194
## sample estimates:
## mean of x mean of y
## 24.39231 17.14737
Since the p-value is essentially 0, I will reject the null. There is evidence that the type of transmission has a relationship with the miles per gallon.
I am 95% confident that the TRUE mean difference in miles per gallon for cars with automatic vs. manual transmission is between 17.15, and 24.39.
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 15.41 17.18 17.82 18.18 19.17 22.90
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 14.50 16.46 17.02 17.36 18.61 19.90
The average mile time for automatic cars sits at 18.18 seconds. For manual cars, the average is 17.36 seconds. Regarding the test, a nearly a second difference in 1/4 mile times is significant. The maximum for manual cars is 19.90 seconds, while for automatic cars it is 22.90 seconds.The data clearly shows that manual cars have quicker quarter mile times.
Null hypothesis: There is no difference in quarter mile times between manual, and automatic transmisson cars1/4 mile times.
Alternate Hypothesis: There is a difference between manual, and automatic transmission cars 1/4 mile times.
##
## Welch Two Sample t-test
##
## data: man$qsec and auto$qsec
## t = -1.2878, df = 25.534, p-value = 0.2093
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -2.1381679 0.4918522
## sample estimates:
## mean of x mean of y
## 17.36000 18.18316
Because the P-value is above 5%, I will accept the null, there is no evidence that 1/4 mile times between manual, and automatic cars differ.
I am 95% confident that the TRUE mean difference in quarter mile times between manual and automatic cars is between 17.36, and 18.18 seconds.
The purpose of this data set was to compare 1973-1974 models of 32 cars, using 10 collection basis, stated in the introduction. Miles per gallon, quarter mile times, and type of transmission were used here. In first comparing the mpg of manual vs. automatic cars in histograms and a t-test, it was found that there is a connection. Manual cars will more than likely yield a higher average miles per gallon.The second comparison was done to find a relationship between transmission type, and 1/4 mile times. After creating a histogram for each and boxplots to directly compare the two, it concluded that there is not a relationship. The type of transmission in the car is irrelevant relating to 1/4 mile time. Different variables could be included to provide more well rounded results, for example, adding in the weight, horsepower, or engine displacement.