This interactive Shiny app predicts a carβs Miles Per Gallon (MPG)
based on its horsepower, using a simple linear model.
It allows users to adjust horsepower and get an instant fuel efficiency prediction.
January 02, 2026
This interactive Shiny app predicts a carβs Miles Per Gallon (MPG)
based on its horsepower, using a simple linear model.
It allows users to adjust horsepower and get an instant fuel efficiency prediction.
Trained on Rβs built-in mtcars dataset
(32 cars with MPG and horsepower measurements)
Linear regression used in the app:
model <- lm(mpg ~ hp, data = mtcars) coef(model)
## (Intercept) hp ## 30.09886054 -0.06822828
Thanks for checking it out!