get_random | R Documentation |
Returns the data from all random effects terms.
get_random(x)
x |
A fitted mixed model. |
The data from all random effects terms, as data frame. Or NULL
if model has no random effects.
data(sleepstudy)
# prepare some data...
sleepstudy$mygrp <- sample(1:5, size = 180, replace = TRUE)
sleepstudy$mysubgrp <- NA
for (i in 1:5) {
filter_group <- sleepstudy$mygrp == i
sleepstudy$mysubgrp[filter_group] <-
sample(1:30, size = sum(filter_group), replace = TRUE)
}
m <- lmer(
Reaction ~ Days + (1 | mygrp / mysubgrp) + (1 | Subject),
data = sleepstudy
)
head(get_random(m))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.