add_model_residuals: Add model residuals

View source: R/add_model_predictions.R View source: R/add_model_predictions.R

add_model_residualsR Documentation

Add model residuals

Description

A dplyr compatible convenience function to add residuals to a data set

Usage

add_model_residuals(model = NULL, old_data = NULL)

Arguments

model

A model object from 'fit_model'

old_data

The data set to which predicted values will be added.

Value

A data.frame object with residuals added.

Examples

data("yields", package="manymodelr")
yields1 <- yields[1:50,]
yields2 <- yields[51:100,]
lm_model <- fit_model(yields1,"weight","height","lm") 
head(add_model_residuals(lm_model, yields2))

manymodelr documentation built on April 4, 2025, 12:01 a.m.