Fuel consumption Prediction
This presentation introduces a Shiny application to predict a vehicle’s fuel consumption (MPG). * Data: ‘mtcars’ (Dataset of 32 automobiles). * Model: Linear Regression.
2025-12-17
This presentation introduces a Shiny application to predict a vehicle’s fuel consumption (MPG). * Data: ‘mtcars’ (Dataset of 32 automobiles). * Model: Linear Regression.
The application allows a user to predict a vehicle’s MPG based on two key, easily obtainable factors:
We use a simple linear regression model where MPG is a function of weight (wt) and cylinders (cyl).
The following code was evaluated during the generation of this slide:
# Requirement: R code that is executed and displayed data(mtcars) mpg_model <- lm(mpg ~ wt + factor(cyl), data = mtcars) coef(mpg_model)
## (Intercept) wt factor(cyl)6 factor(cyl)8 ## 33.990794 -3.205613 -4.255582 -6.070860
If a user selects a weight of 3,000 lbs (3.0) and 6 cylinders, the server runs:
## 1 ## 20.11837
mtcars industry dataset.Thank you for evaluating this project!