extract_regression_residuals {tidyAML}R Documentation

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)

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.

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.

Value

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

Author(s)

Steven P. Sanderson II, MPH

See Also

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

Examples

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)


[Package tidyAML version 0.0.5 Index]