3/22/2026

Why Horsepower Matters

The relationship between a car’s power and its fuel efficiency is a critical metric for consumers.

  • Trade-off: Higher performance often leads to lower efficiency.
  • The Solution: Our tool helps users estimate MPG instantly.
  • Goal: Simple, data-driven insights using R and Shiny.

Deep Dive into the Data

summary(mtcars[, c("mpg", "hp")])
##       mpg              hp       
##  Min.   :10.40   Min.   : 52.0  
##  1st Qu.:15.43   1st Qu.: 96.5  
##  Median :19.20   Median :123.0  
##  Mean   :20.09   Mean   :146.7  
##  3rd Qu.:22.80   3rd Qu.:180.0  
##  Max.   :33.90   Max.   :335.0
  • MPG Range: 10.4 to 33.9
  • HP Range: 52 to 335
  • Correlation: A strong negative relationship exists between power and economy.

Visualizing the Impact

A quick look at the regression line shows exactly how fuel economy drops as horsepower climbs.

plot(mtcars$hp, mtcars$mpg, pch=19, col="blue", xlab="Horsepower", ylab="MPG")
abline(lm(mpg ~ hp, data=mtcars), col="red", lwd=2)

The Prediction Engine

Our app uses a Linear Regression model. For any horsepower input, we calculate the expected MPG using this formula:

model <- lm(mpg ~ hp, data = mtcars)
coef(model)
## (Intercept)          hp 
## 30.09886054 -0.06822828

The Logic: For every 10-point increase in horsepower, you can expect a drop of approximately 0.7 MPG.