add_resid | R Documentation |
Add residuals of different types to dataframe
add_resid(data, model, var = "resid", type)
data |
dataframe or tibble |
model |
model object |
var |
name of new variable in dataframe / tibble |
type |
type of residual value |
dataframe / tibble
Søren Højsgaard
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.