January 31, 2026

The Concept

Buying a car involves understanding fuel efficiency. This application helps users predict Miles Per Gallon (MPG) based on two key factors:

  • Gross Horsepower: How much power the engine produces.

  • Weight: How heavy the car is (in thousands of lbs).

How it Works

The application features a user-friendly sidebar with:

  • Slider Inputs: Precisely select Horsepower and Weight.

  • Reactive Plot: A real-time visualization showing where your input falls compared to the mtcars dataset.

  • Instant Calculation: The prediction updates the moment you move a slider—no “Submit” button required!

The Data (Evaluated R Code)

summary(mtcars$mpg)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   10.40   15.43   19.20   20.09   22.80   33.90

The Prediction Model

The app uses a multivariate linear regression. You can see the relationship between weight and MPG here:

## `geom_smooth()` using formula = 'y ~ x'

THANK YOU!