Maitreya Tarmale
October 27, 2026
A Shiny app that predicts a car's fuel efficiency (miles per gallon)
The app fits a linear regression on mtcars using weight, horsepower and transmission type.
fit <- lm(mpg ~ wt + hp + am, data = mtcars)
round(summary(fit)$r.squared, 3)
[1] 0.84
predict(fit, data.frame(wt = 3, hp = 120, am = 1))
1
22.95341