The problem is that afex::mixed
returns an object, of class "mixed"
, where the original lme4
object is in slot full_model
:
library("afex")
data("Machines", package = "MEMSS")
m1 <- mixed(score ~ Machine + (Machine|Worker), data=Machines)
str(m1, 1)
# List of 5
# $ anova_table :Classes ‘anova’ and 'data.frame': 1 obs. of 4 variables:
# ..- attr(*, "heading")= chr [1:3] "Mixed Model Anova Table (Type 3 tests, KR-method)\n" "Model: score ~ Machine + (Machine | Worker)" "Data: Machines"
# ..- attr(*, "sig_symbols")= chr [1:4] " +" " *" " **" " ***"
# $ full_model :Formal class 'merModLmerTest' [package "lmerTest"] with 13 slots
# $ restricted_models: NULL
# $ tests : NULL
# $ data :'data.frame': 54 obs. of 3 variables:
# - attr(*, "class")= chr "mixed"
# - attr(*, "type")= num 3
# - attr(*, "method")= chr "KR"
So one just needs to pass this slot to the corresponding function and not the whole object. This works for example via $
:
library("lattice")
dotplot(ranef(m1$full_model, condV=TRUE))
Hope that helps!