obtain_diagnostics: Obtain residuals and fitted values for diagnostics.

View source: R/modeling_phrases.R

obtain_diagnosticsR Documentation

Obtain residuals and fitted values for diagnostics.

Description

A wrapper for augment which obtains residuals and fitted values only for a specified data generating process.

Usage

obtain_diagnostics(mean.model, data)

Arguments

mean.model

lm or glm model fit defining the model from which residuals and predicted values are to be computed.

data

the original data set to which the fitted values and residuals should be added. Defaults to extracting the data from the model.

Value

A data.frame containing one row for each observations, with two columns added to the original data:

  • .fitted: the fitted values for the model.

  • .resid: the residuals for the model.

Examples

fit <- lm(mpg ~ hp, data = mtcars)
mtcars.aug <- obtain_diagnostics(fit, data = mtcars)


reyesem/IntroAnalysis documentation built on March 29, 2025, 3:29 p.m.