Lab 05

Recipes + Model comparison

Oct 20 - 21, 2022

Welcome

Goals

  • Review interaction effects
  • Lab 05: Halloween candy

Interaction terms

Diamonds data

The data contain the price and other attributes of a random sample of 1000 diamonds. This sample was drawn from the diamonds data frame in the tidyverse R package.

The variables in this example are

  • price: Price in US dollars

  • carat: Weight of the diamond (units = carats)

  • cut: Quality of the cut of the diamond (Fair, Good, Ideal)

The goal is to use the carat and cut to understand variability in the price.

Exploratory data analysis

Does the plot show evidence of an interaction effect between carats and cut?

Model

term estimate
(Intercept) -2473.555
carat 6383.913
cutGood 60.018
cutIdeal 0.044
carat:cutGood 982.952
carat:cutIdeal 2132.642
  • Interpret the coefficient of cutGood in the context of the data.
  • Interpret the coefficient of carat:cutGood in the context of the data.
  • Suppose we fit a model for Fair cut diamonds. What is the intercept? What is the slope of carat ?
  • Suppose we fit a model for Ideal cut diamonds. What is the intercept? What is the slope of carat?

Lab 05: Recipes + Model Comparison

Resources for Lab 05