Skip to contents

A generic function to extract the conditional modes of the random effects from a fitted model object. For linear mixed models the conditional modes of the random effects are also the conditional means.

Arguments

object

an object of a class of fitted models with random effects.

Value

  • From ranef: An object composed of a list of data frames, one for each grouping factor for the random effects. The number of rows in the data frame is the number of levels of the grouping factor. The number of columns is the dimension of the random effect associated with each level of the factor.

Details

If grouping factor i has k levels and j random effects per level the ith component of the list returned by ranef is a data frame with k rows and j columns.

Examples

  # \donttest{
  library(lattice) ## for dotplot, qqmath
  library(lme4)
  fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
  fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
  fm3 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
  ranef(fm1)
#> $Subject
#>     (Intercept)        Days
#> 308   2.2585509   9.1989758
#> 309 -40.3987381  -8.6196806
#> 310 -38.9604090  -5.4488565
#> 330  23.6906196  -4.8143503
#> 331  22.2603126  -3.0699116
#> 332   9.0395679  -0.2721770
#> 333  16.8405086  -0.2236361
#> 334  -7.2326151   1.0745816
#> 335  -0.3336684 -10.7521652
#> 337  34.8904868   8.6282652
#> 349 -25.2102286   1.1734322
#> 350 -13.0700342   6.6142178
#> 351   4.5778642  -3.0152621
#> 352  20.8636782   3.5360011
#> 369   3.2754656   0.8722149
#> 370 -25.6129993   4.8224850
#> 371   0.8070461  -0.9881562
#> 372  12.3145921   1.2840221
#> 
#> with conditional variances for "Subject" 
  # }