Comparing Fuel Efficiency for automatic transmission vs. manual transmission cars

Below are summary statistics on fuel efficiency (in miles/gallon) from random samples of cars with manual and automatic transmissions manufactured in 2012. Do these data provide strong evidence of a difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage?

# load data ---------------------------------------------------------
fuel_eff <- read.csv("https://mhc-stat140-2017.github.io/data/misc/fuel_eff.csv")

# select a small sample ---------------------------------------------
man_rows <- which(fuel_eff$transmission == "M")
aut_rows <- which(fuel_eff$transmission == "A")

set.seed(3583)
man_rows_samp <- sample(man_rows, 26)
aut_rows_samp <- sample(aut_rows, 26)

fuel_eff_samp <- fuel_eff[c(man_rows_samp,aut_rows_samp), ]
fuel_eff_samp$transmission <- droplevels(fuel_eff_samp$transmission)

levels(fuel_eff_samp$transmission) <- c("automatic", "manual")

ggplot() +
  geom_density(mapping = aes(x = comb_mpg, color = transmission), data = fuel_eff_samp)

fuel_eff_man <- filter(fuel_eff_samp, transmission == "manual")
fuel_eff_aut <- filter(fuel_eff_samp, transmission == "automatic")

mean(fuel_eff_man$comb_mpg)
## [1] 22.85
sd(fuel_eff_man$comb_mpg)
## [1] 4.73
mean(fuel_eff_aut$comb_mpg)
## [1] 18.65
sd(fuel_eff_aut$comb_mpg)
## [1] 4.137

State the null and alternative hypotheses

Check Assumptions for Inference

Paired or Unpaired?

Are these data paired or unpaired?

SOLUTION:

1. Independence

  • Among observations within each group and observations in different groups for a two-sample test
  • Among the different pairs for a paired test

SOLUTION:

2. Nearly Normal

  • Check separately for both groups for a two-sample test
  • Check for the differences for a paired test

SOLUTION:

3. Sample size big enough

  • Check separately for both groups for a two-sample test
  • Check for the number of pairs for a paired test

SOLUTION:

Do the mechanics of the test

You can use t.test() function.

# call to t.test() here

Draw a conclusion in context of the problem

SOLUTION:

State a 95% confidence interval and interpret it in context.

SOLUTION:

Accidents on Friday the 13th

The British Medical Journal published an article titled “Is Friday the 13th Bad for Your Health?” The article examined the number of people admitted to emergency rooms for vehicular accidents on 12 Friday evenings (6 each on the 6th and 13th). Here are the data:

friday13 <- read.csv("https://mhc-stat140-2017.github.io/data/sdm4/Friday_the_13th_Part_2.csv") %>%
  mutate(difference = X13th - X6th)
head(friday13)

Is there a difference between rates of accidents on Friday the 13th and Friday the 6th?

State Hypotheses

SOLUTION:

Check Assumptions for Inference

Paired or Unpaired?

Are these data paired or unpaired?

SOLUTION:

1. Independence

  • Among observations within each group and observations in different groups for a two-sample test
  • Among the different pairs for a paired test

SOLUTION:

2. Nearly Normal

  • Check separately for both groups for a two-sample test
  • Check for the differences for a paired test

SOLUTION:

3. Sample size big enough

  • Check separately for both groups for a two-sample test
  • Check for the number of pairs for a paired test

SOLUTION:

Calculate a p-value

You can use t.test() function.

SOLUTION:

# Your code goes here

Draw a Conclusion

SOLUTION:

State a 99% confidence interval and interpret it in context.

SOLUTION: