October 28, 2026

Introduction & Motivation

  • Objective: Build an intuitive, interactive web application to predict automobile fuel efficiency (mpg).
  • Target Audience: Car buyers, automotive analysts, and data science students seeking rapid exploratory insights.
  • Data Source: Built-in R mtcars dataset extracted from the 1974 Motor Trend US magazine.

Application Architecture & Features

The Shiny application consists of two core components: 1. User Interface (ui.R): - Reactive widgets including a horsepower slider and cylinder radio buttons. - Built-in documentation tab providing step-by-step user guidance. 2. Server Logic (server.R): - Dynamically fits a linear regression model. - Computes real-time predictions and subset summary statistics.

Embedded R Model & Analysis

The application relies on a linear regression model to forecast fuel economy. Here is a demonstration of the evaluated model code:

fit <- lm(mpg ~ hp + cyl, data = mtcars)
coef(fit)
## (Intercept)          hp         cyl 
##  36.9083305  -0.0191217  -2.2646936