Learn R Programming

doBy (version 4.6.26)

add_resid: Add residuals of different types to dataframe

Description

Add residuals of different types to dataframe

Usage

add_resid(data, model, var = "resid", type)

Value

dataframe / tibble

Arguments

data

dataframe or tibble

model

model object

var

name of new variable in dataframe / tibble

type

type of residual value

Author

Søren Højsgaard

Examples

Run this code
data(cars)
lm1 <- lm(dist ~ speed + I(speed^2), data=cars)
lm1 |> response() |> head()
cars <- cars |> add_pred(lm1)
cars |> head()
cars <- cars |> add_resid(lm1)
cars 

Run the code above in your browser using DataLab