Introduction

This report explores the mtcars dataset, which contains performance data for 32 cars from the 1974 Motor Trend US magazine. Our goal is to understand key features of the data to inform a Shiny app and prediction algorithm for estimating fuel efficiency (MPG). This analysis is designed to be clear for non-technical managers.

Data Loading and Structure

The mtcars dataset was successfully loaded from R’s built-in datasets. It includes 32 observations and 11 variables, such as miles per gallon (mpg), horsepower (hp), weight (wt), and number of cylinders (cyl).

Dataset Variables
Variable Description
mpg Miles per gallon (fuel efficiency)
cyl Number of cylinders
disp Displacement (cu.in.)
hp Gross horsepower
drat Rear axle ratio
wt Weight (1000 lbs)
qsec 1/4 mile time
vs V/S engine configuration
am Transmission (0 = auto, 1 = manual)
gear Number of forward gears
carb Number of carburetors

Summary Statistics

Below is a summary of key numeric variables: mpg, horsepower, and weight.

Summary Statistics for Key Variables
mpg hp wt
Min. :10.40 Min. : 52.0 Min. :1.513
1st Qu.:15.43 1st Qu.: 96.5 1st Qu.:2.581
Median :19.20 Median :123.0 Median :3.325
Mean :20.09 Mean :146.7 Mean :3.217
3rd Qu.:22.80 3rd Qu.:180.0 3rd Qu.:3.610
Max. :33.90 Max. :335.0 Max. :5.424

Key Findings

Distribution of Fuel Efficiency (MPG)

The histogram below shows the distribution of MPG across the dataset.

  • Insight: MPG is roughly normally distributed, with most cars achieving 15–25 MPG.

Relationship Between MPG and Horsepower

A scatter plot reveals how MPG relates to horsepower.

  • Insight: Higher horsepower tends to correlate with lower MPG, and heavier cars (larger points) generally have lower fuel efficiency.

Categorical Breakdown

The table below summarizes the number of cars by cylinders and transmission type.

Cars by Cylinders and Transmission
Cylinders Transmission Count
4 Automatic 3
6 Automatic 4
8 Automatic 12
4 Manual 8
6 Manual 3
8 Manual 2
  • Insight: Most 8-cylinder cars have automatic transmissions, while 4-cylinder cars are more evenly split.

Plans for Prediction Algorithm and Shiny App

Prediction Algorithm

We aim to predict fuel efficiency (MPG) using a linear regression model based on variables like horsepower, weight, and cylinders. These variables showed strong relationships with MPG in the scatter plot. The model will: - Use a simple formula to estimate MPG from user inputs. - Be tested for accuracy using cross-validation to ensure reliable predictions.

Shiny App

The Shiny app will allow users to: - Input car characteristics (e.g., horsepower, weight, cylinders) via sliders or dropdowns. - View the predicted MPG and an interactive plot comparing their input to the dataset. - Explore the data with filters (e.g., transmission type) to understand trends.

The app will be user-friendly, with clear instructions and visualizations, hosted on ShinyApps.io for easy access.

Conclusion

This analysis confirms the mtcars dataset is loaded and reveals key trends: MPG decreases with higher horsepower and weight, and cylinder counts vary by transmission type. These insights will guide a prediction model and Shiny app to help users estimate fuel efficiency interactively. Feedback on this plan is welcome to refine the approach.