December 23, 2025

1. The Concept: Efficiency Simplified

The AutoMetrics MPG Predictor is a high-performance data tool designed to bridge the gap between engine specifications and real-world fuel economy.

The Problem: Understanding how weight and horsepower impact fuel costs is often unintuitive for the average driver.

The Solution: A reactive web interface that provides instant, data-driven estimates.

Data-Driven: Built using the industry-standard mtcars dataset (1974 Motor Trend US magazine).

2. Interactive User Interface

The application features a modern, “Lux” themed dashboard built with Bootstrap 5. It uses three primary input widgets to allow for granular control:

Horsepower Slider: Dynamically adjust the engine’s gross horsepower.

Cylinder Toggle: Choose between 4, 6, or 8-cylinder engine configurations.

Weight Input: Account for vehicle mass (measured in thousands of lbs).

Reactivity: Predictions are only calculated when the “Calculate” button is pressed to ensure a smooth user experience.

3. The Prediction Engine (Reproducible Code)

The app utilizes a Linear Regression model. Below is the evaluated R code showing the impact of Horsepower and Weight on Miles Per Gallon (MPG):

# Linear regression model including cylinders
fit <- lm(mpg ~ hp + wt + cyl, data = mtcars)
summary(fit)$coefficients
##               Estimate Std. Error   t value     Pr(>|t|)
## (Intercept) 38.7517874 1.78686403 21.687038 4.799399e-19
## hp          -0.0180381 0.01187625 -1.518838 1.400152e-01
## wt          -3.1669731 0.74057588 -4.276365 1.994765e-04
## cyl         -0.9416168 0.55091638 -1.709183 9.848010e-02

The output above confirms that as Horsepower and Weight increase, MPG significantly decreases.

4. Visualizing the Relationship

The app provides a real-time plot. The gray dots represent historical data, while the Blue Diamond (in the live app) moves to show your specific prediction.

## `geom_smooth()` using formula = 'y ~ x'

5. Experience AutoMetrics

The application is fully deployed and available for testing. It includes built-in documentation to assist novice users.

Live Application: https://bilalhassannizami.shinyapps.io/autometrics-mpg/

Thank you for evaluating this project! Developed for the Developing Data Products Peer Assessment.