Learn R Programming

tidyAML (version 0.0.6)

extract_regression_residuals: Extract Residuals from Fast Regression Models

Description

This function extracts residuals from a fast regression model table (fast_regression()).

Usage

extract_regression_residuals(.model_tbl, .pivot_long = FALSE)

Value

The function returns a list of data frames, each containing residuals, actual values, and predicted values for a specific model.

Arguments

.model_tbl

A fast regression model specification table (fst_reg_spec_tbl).

.pivot_long

A logical value indicating if the output should be pivoted. The default is FALSE.

Author

Steven P. Sanderson II, MPH

Details

The function checks if the input model specification table inherits the class 'fst_reg_spec_tbl' and if it contains the column 'pred_wflw'. It then manipulates the data, grouping it by model, and extracts residuals for each model. The result is a list of data frames, each containing residuals, actual values, and predicted values for a specific model.

See Also

Other Extractor: extract_model_spec(), extract_tunable_params(), extract_wflw(), extract_wflw_fit(), extract_wflw_pred(), get_model()

Examples

Run this code
library(recipes, quietly = TRUE)

rec_obj <- recipe(mpg ~ ., data = mtcars)

fr_tbl <- fast_regression(mtcars, rec_obj, .parsnip_eng = c("lm","glm"),
.parsnip_fns = "linear_reg")

extract_regression_residuals(fr_tbl)
extract_regression_residuals(fr_tbl, .pivot_long = TRUE)

Run the code above in your browser using DataLab