Search⌘ K
AI Features

The get_regression_x() Functions

Explore the get_regression_x functions which are wrapper functions in R that simplify producing regression tables and point-by-point regression details. Understand how these functions use tidy, augment, and clean_names to transform complex regression outputs into tidy data frames with fitted values, residuals, and summaries, helping you implement basic regression analysis efficiently with moderndive and tidyverse tools.

We'll cover the following...

Recall that we introduced two functions from the moderndive package:

  • The get_regression_table() function that returns a regression table

  • The get_regression_points() function that returns point-by-point information from a regression model

What’s going on behind the scenes with the get_regression_table() and get_regression_points() functions? We mentioned that these were examples of wrapper functions. Such functions take other preexisting functions and wrap them into single functions that hide the user from their inner workings. This way, all the user needs to worry about is what the inputs look like and what the outputs look like. Let’s try to closely examine these functions and see how the “engine” of these wrapper functions works.

Recall our two-step process to generate a regression table:

R
# Fit regression model:
score_model <- lm(formula = score ~ bty_avg, data = evals_ch5)
# Get regression table:
get_regression_table(score_model)

The get_regression_table() wrapper function takes two preexisting functions in other R packages:

  • The ...