- Fuel efficiency matters
- Quick MPG estimate from simple inputs
- Based on classic mtcars dataset
- Beginner-friendly UI πβ¨
2025-10-28
This is the prediction model your Shiny app uses:
model <- lm(mpg ~ wt + hp + am, data = mtcars) summary(model)
Example prediction for a manual car, weight = 3, hp = 110:
pred <- predict( model, newdata = data.frame(wt = 3, hp = 110, am = 1), se.fit = TRUE ) paste0(round(pred\(fit, 2), " MPG (Β±", round(pred\)se.fit, 2), β SE)β)
library(plotly) p <- plot_ly(mtcars, x = ~wt, y = ~mpg, type = βscatterβ, mode = βmarkersβ) p