Description Usage Arguments Details Value Examples
View source: R/compute_redres.R
Computes residuals for a given linear mixed model.
1 | compute_redres(model, type = "raw_cond")
|
model |
Model fit using |
type |
String identifying type of residual. Default is "raw_cond". See details for the options available. |
Residual types available:
"pearson_cond"
: Pearson conditional residuals
"pearson_mar"
: Pearson marginal residuals
"raw_cond"
: raw conditional residuals (default)
"raw_mar"
: raw marginal residuals
"std_cond"
: studentized conditional residuals
"std_mar"
: studentized marginal residuals
See the vignette for details on how residual types are computed.
Returns a vector of residuals according to type specified. Residuals appear in the same order as the observations used to fit the model.
1 2 3 4 5 6 7 8 9 | # fits a linear mixed effects model
library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)
# computes the default residuals (raw conditional)
compute_redres(fm1)
# changes the residual type to studentized marginal
compute_redres(fm1, type = "std_mar")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.