mem.getcomp | R Documentation |
Assuming a mixed-effects model of form y_fit = Xb + Zu + e, where X is the model matrix for fixed effects, Z is the model matrix for random effects, and b and u are the fixed and random effects respectively, this function returns these components per each fitted value y. These may be useful for model inference and/or diagnostic purposes.
mem.getcomp(fit)
fit |
A fitted mixed-effects model generated either through the lme4 or the nlme package. |
Notice that per-observation model error is e = Xb + Zu - y_observation. Similarly, the components Xb and Zu are extracted.
The function returns per-observation model fit components for a mixed-effects model. The return fields are
Xb |
Fixed effects component Xb |
Zu |
Random effects component Zu |
XbZu |
Full model fit by summing the above two Xb+Zu |
e |
Model error e |
y |
Original observations y |
Teemu Daniel Laajala <teelaa@utu.fi>
mem.plotran
mem.plotresid
data(vcaplong)
exdat <- vcaplong[vcaplong[,"Group"] %in% c("Vehicle", "ARN"),]
library(lme4)
f1 <- lmer(log2PSA ~ 1 + DrugWeek + DrugWeek:ARN + (1 + DrugWeek|ID), data = exdat)
mem.getcomp(f1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.