October 30, 2025

The Problem & Solution

Problem: It’s hard to quickly estimate a car’s fuel efficiency (MPG) just by looking at its engine power (horsepower).

Solution: A simple, interactive Shiny application that gives an instant prediction based on a pre-built model.

The Application

This is what the application looks like.

  • Simple: The user only needs to move one slider.
  • Instant: The prediction updates live.
  • Documented: Instructions are built right into the app.

How It Works

The application is powered by a simple linear regression model.

  • Dataset: It uses the built-in mtcars dataset.
  • Model: It runs lm(mpg ~ hp, data = mtcars) to find the relationship between horsepower and MPG.
  • Prediction: It uses this model to predict the MPG for whatever horsepower the user selects.

Try It Yourself! (Live R Code)

You can run the app and see the code at the links below.

App Link: https://krips707.shinyapps.io/ddp_final/

GitHub Code Link: https://github.com/prakdwi/coursera-shiny-app

This presentation was made with R Markdown. Here is the embedded R code (as required by the assignment) showing a summary of the data used in the model:

# data
summary(mtcars$hp)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    52.0    96.5   123.0   146.7   180.0   335.0