Diamond Price Predictor

Chaithra
March 15, 26

Why Use This App?

Buying a diamond is a major investment. This application helps users:

  • Predict Prices: Get an instant estimate based on carat weight.
  • Filter by Quality: See how “Cut” affects value.
  • Data Driven: Uses the famous diamonds dataset for accuracy.

The Data Source

We utilize the ggplot2 diamonds dataset, which contains prices and attributes for over 50,000 diamonds.

# This is an evaluated R expression
library(ggplot2)
summary(diamonds$price)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    326     950    2401    3933    5324   18823 
# This code runs but the code itself is hidden (echo=FALSE)
plot(diamonds$carat, diamonds$price, col="blue", 
     xlab="Carat", ylab="Price ($)", main="Price vs Carat")

plot of chunk unnamed-chunk-1

The Prediction Logic

plot(diamonds$carat, diamonds$price, col="blue", 
     xlab="Carat", ylab="Price ($)", main="Price vs Carat")
abline(lm(price ~ carat, data=diamonds), col="red", lwd=3)

plot of chunk unnamed-chunk-2

Reactive Features

The application is built with Shiny Reactivity, meaning: The server recalculates the model instantly when you move the slider. No “Submit” button is required; the UI updates in real-time. The plot highlights exactly where your selected diamond sits compared to the rest of the data.