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.
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).
| 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 |
Below is a summary of key numeric variables: mpg, horsepower, and weight.
| 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 |
The histogram below shows the distribution of MPG across the dataset.
A scatter plot reveals how MPG relates to horsepower.
The table below summarizes the number of cars by cylinders and transmission type.
| Cylinders | Transmission | Count |
|---|---|---|
| 4 | Automatic | 3 |
| 6 | Automatic | 4 |
| 8 | Automatic | 12 |
| 4 | Manual | 8 |
| 6 | Manual | 3 |
| 8 | Manual | 2 |
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.
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.
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.