Dorthy Grover
2025-10-30
Welcome to my Shiny App Pitch Presentation!
This presentation introduces a Shiny web application
that predicts the Miles per Gallon (MPG) of a car based
on various features from the Motor Trend dataset
(mtcars).
The app was developed in RStudio using: - Shiny for interactivity - ggplot2 for visualization - dplyr for data handling
The Shiny app lets users: - Choose car attributes such as horsepower,
weight, and transmission type
- View predicted MPG based on those inputs
- See visual comparisons of their chosen configuration against the
dataset
It’s an interactive demonstration of linear regression applied to real-world car data.
The model formula used: ```r lm(mpg ~ wt + hp + am, data = mtcars) This model allows the app to calculate how MPG changes depending on car attributes.
The app interface includes sliders and buttons to let users explore these relationships interactively. Slide 3 How the App Works
Here’s a breakdown of the logic:
Input widgets take user choices:
Sliders for horsepower and weight
Radio buttons for transmission type
Server logic performs calculations using the model: pred <- predict(model, newdata = data.frame( wt = input\(wt, hp = input\)hp, am = input$am)) Slide 4 The UI (User Interface) contains interactive controls and dynamic output. ui <- fluidPage( titlePanel(“MPG Prediction App”),
sidebarLayout( sidebarPanel( sliderInput(“hp”, “Horsepower:”, min = 50, max = 350, value = 150), sliderInput(“wt”, “Weight (1000 lbs):”, min = 1.5, max = 5.5, value = 3), radioButtons(“am”, “Transmission:”, choices = c(“Automatic”, “Manual”)) ),
mainPanel(
textOutput("prediction"),
plotOutput("plot")
)
) ) Server logic for prediction and plotting: server <- function(input, output) { model <- lm(mpg ~ hp + wt + am, data = mtcars)
output$prediction <- renderText({ pred <- predict_mpg() paste(“Predicted MPG:”, round(pred, 2)) })
output\(plot <- renderPlot({ plot(mtcars\)hp, mtcars$mpg, xlab = “Horsepower”, ylab = “MPG”, main = “MPG vs Horsepower”) abline(model, col = “blue”) }) } slide 5: Links & Next Steps
Try It Yourself!
App Link: Paste your shinyapps.io URL here
Code Repository: Paste your GitHub repository URL here
Instructions:
Visit the app link.
Adjust horsepower, weight, and transmission inputs.
View the predicted MPG and graph update instantly.
Next Steps:
Add more predictors (e.g., cylinders, displacement)
Include confidence intervals in predictions
Expand dataset for real-world car models