CarSmart: Know Your Fuel Costs

Rishabh Sharda
October 27, 2026

A five-slide reproducible pitch

Estimate vehicle MPG, fuel consumption, and annual fuel cost — interactively.

Built using R Shiny, a regression model, and the built-in mtcars dataset.

The Problem: Fuel Costs Are Hard to Visualize

  • Fuel costs depend on how efficiently a car drives and how far we travel.
  • Many people do not know how to translate MPG into an annual budget.
  • Comparing different vehicles or hypothetical fuel-efficiency gains should be simple.

CarSmart's promise

Five inputs → an instant, interpretable fuel-cost estimate.

The Engine: Real R Calculations

The prediction uses weight, horsepower, and transmission.

cars <- mtcars
cars$transmission <- factor(cars$am, levels=c(0,1),
                            labels=c("Automatic", "Manual"))
fit <- lm(mpg ~ wt + hp + transmission, data=cars)
example_car <- data.frame(wt=3, hp=120,
   transmission=factor("Automatic", levels=levels(cars$transmission)))
example_mpg <- as.numeric(predict(fit, newdata=example_car))
round(c(MPG=example_mpg, Annual_cost_USD=12000/example_mpg*3.50), 2)
            MPG Annual_cost_USD 
          20.87         2012.49 

The code above executes when the presentation renders.

Visual Evidence from the Data

The model uses all 32 historical cars in R's built-in mtcars dataset.

plot of chunk unnamed-chunk-2

Why Try CarSmart?

Interactive, transparent, and beginner-friendly

  • Input controls: Weight, horsepower, transmission, annual mileage, fuel price.
  • Live outputs: Predicted MPG, annual fuel use, and annual USD cost.
  • Explore: See sample vehicles and hypothetical 10%/20% MPG improvements.
  • Learn: Built-in How to use tab explains every input and limitation.

Try the Shiny application using the submitted Shiny URL.

Note: Based on a small historical dataset; for learning, not buying decisions.