Using broom
Many programming tasks are easier if you keep all your data inside data frames. This is particularly true if you are a tidyverse fan, where dplyr
and ggplot2
require you to use data frames. The broom
package contains functions that decompose models into three data frames: one for the coefficient-level elements (the coefficients themselves, as well as p-values for each coefficient), the observation-level elements (like fitted values and residuals), and the model-level elements (mostly performance metrics).
The functions in broom
are generic. That is, they work with many model types, not just linear regression model objects. They also work with logistic regression model objects (as you'll see in Chapter 4), and many other types of model.
mdl_price_vs_conv
is available and broom
is loaded.
This exercise is part of the course
Introduction to Regression in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Get the coefficient-level elements of the model
___