2025-11-09

Background: Hypothesis Testing

We are testing whether there is a difference in mean fuel efficiency between two transmission types.

\[ H_0: \mu_\text{manual} = \mu_\text{auto} \text{ vs } H_1: \mu_\text{manual} \neq \mu_\text{auto} \]

\[ t = \frac{\bar{X}_1 - \bar{X}_2}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}} \]

If \(p < 0.05\), we reject the null hypothesis.

Summary of Data used from Dataset

MPG A/M Horsepower(HP) Weight
Min. :10.40 Automatic:19 Min. : 52.0 Min. :1.513
1st Qu.:15.43 Manual :13 1st Qu.: 96.5 1st Qu.:2.581
Median :19.20 NA Median :123.0 Median :3.325
Mean :20.09 NA Mean :146.7 Mean :3.217
3rd Qu.:22.80 NA 3rd Qu.:180.0 3rd Qu.:3.610
Max. :33.90 NA Max. :335.0 Max. :5.424

Boxplot of MPG(Miles Per Gallon) for each Transmission

Lineplot of MPG by Density for each Transmission

3D plot of Weight, Horsepower, and MPG for each Transmission

R code to perform T-Test and Results

R code:

t_test_result <- t.test(mpg ~ am, data = mtcars, var.equal = TRUE) t_test_result

Results:

## 
##  Two Sample t-test
## 
## data:  mpg by am
## t = -4.1061, df = 30, p-value = 0.000285
## alternative hypothesis: true difference in means between group Automatic and group Manual is not equal to 0
## 95 percent confidence interval:
##  -10.84837  -3.64151
## sample estimates:
## mean in group Automatic    mean in group Manual 
##                17.14737                24.39231

Conclusion from T-Test

\[ p < 0.05 \rightarrow \text{Reject } H_0 \]

This means that the average fuel efficiency greatly differs between automatic and manual transmission cars