## Rows: 32
## Columns: 11
## $ mpg  <dbl> 21.0, 21.0, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8,…
## $ cyl  <fct> 6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 8,…
## $ disp <dbl> 160.0, 160.0, 108.0, 258.0, 360.0, 225.0, 360.0, 146.7, 140.8, 16…
## $ hp   <dbl> 110, 110, 93, 110, 175, 105, 245, 62, 95, 123, 123, 180, 180, 180…
## $ drat <dbl> 3.90, 3.90, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92,…
## $ wt   <dbl> 2.620, 2.875, 2.320, 3.215, 3.440, 3.460, 3.570, 3.190, 3.150, 3.…
## $ qsec <dbl> 16.46, 17.02, 18.61, 19.44, 17.02, 20.22, 15.84, 20.00, 22.90, 18…
## $ vs   <dbl> 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,…
## $ am   <fct> Manual, Manual, Manual, Automatic, Automatic, Automatic, Automati…
## $ gear <fct> 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3,…
## $ carb <dbl> 4, 4, 1, 1, 2, 1, 4, 2, 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2,…
## # A tibble: 3 × 5
##   cyl   count mean_mpg mean_hp mean_wt
##   <fct> <int>    <dbl>   <dbl>   <dbl>
## 1 4        11     26.7    82.6    2.29
## 2 6         7     19.7   122.     3.12
## 3 8        14     15.1   209.     4.00

The Dataset

  • This project uses the mtcars dataset, which comes built into R and originates from the 1974 Motor Trend US magazine.

  • The dataset includes data on 32 car models, focusing on fuel efficiency, engine design, and performance characteristics.

  • It contains 11 columns, with major ones such as:

  • mpg : Miles per gallon (fuel efficiency)

  • cyl : Number of cylinders

  • hp : Gross horsepower

  • wt : Weight (in 1000 lbs)

  • am : Transmission type (0 = automatic, 1 = manual)

Scatterplot — MPG vs Weight

This is a scatterplot showing the relationship between car weight and fuel efficiency.

Boxplot — MPG by Transmission

This boxplot shows a positive relationship between manual transmission and fuel efficiency which means that a car with a manual transmission achieves better miles per gallon

3D Scatter — HP, Weight, MPG

Bar Plot — Cars by Gear and Transmission

Statistical Analysis

The miles per gallon values range from 10.4 to 33.9, with an average of 20.09 and a median of 19.2 indicating that most cars in the dataset achieve moderate fuel efficiency. The distribution is slightly right skewed, suggesting that while most cars cluster between 15 and 23 miles per gallon and few cars perform significantly better in terms of fuel economy

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   10.40   15.43   19.20   20.09   22.80   33.90

Conclusion

-Based on the scatterplots and boxplots, there appears to be a trend between car weight, engine power, and fuel efficiency. Heavier cars and those with higher horsepower tend to have lower mpg. For example, cars with 8 cylinders are generally heavier and have higher horsepower, and their mpg values are skewed toward the lower end.

-This indicates a clear inverse relationship between weight and power and fuel efficiency. However, other factors such as transmission type also influence mpg, and when viewed with the boxplots, it appears that manual cars generally achieve slightly higher mpg than automatic cars of similar weight. Overall, fuel efficiency depends on a combination of car characteristics, suggesting a more complex relationship between design and performance. Thanks you for your time reading this!