August 31, 2026

The question

Can carat predict diamond price?

The diamonds dataset includes prices and measurements for more than 50,000 diamonds. This analysis uses two variables:

  • carat: diamond weight
  • price: price in US dollars

Data source: ggplot2::diamonds dataset documentation

The model

The model uses carat to estimate price.

\[ \widehat{price} = b_0 + b_1(carat) \]

The slope (b_1) is about $7,756 for each additional carat.

That is an average estimate. It is not the exact price difference for every diamond.

The relationship

The points show individual diamonds. The line shows the price predicted by carat. The upward pattern is clear, but the points are spread out.

An interactive view

Hover over a point to see its carat and price.

Model check and prediction

The residual is the actual price minus the predicted price. The spread grows at higher prices, so carat alone misses other features that affect price.

The model gives \(R^2 = 0.849\). Carat explains about 84.9 percent of the price variation.

For a one-carat diamond, the predicted price is $5,500.

The R code

diamond_model = lm(price ~ carat, data = diamonds)

diamond_plot = ggplot(diamonds, aes(x = carat, y = price)) +
  geom_point(alpha = 0.12) +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    x = "Diamond weight (carats)",
    y = "Price (US dollars)"
  )

prediction_data = data.frame(carat = 1)
predict(diamond_model, newdata = prediction_data)

Conclusion

Carat is a useful first predictor of diamond price.

The model is not exact because it leaves out cut, color, clarity, and other features.

The answer to the question is yes. Carat predicts price, but a better model would use more than one variable.