amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
446 stars 108 forks source link

Cannot pool fitted mixed effects models #245

Closed studerus closed 4 years ago

studerus commented 4 years ago

Pooling multiple fitted mixed effects models results in the following error message: Error: No tidy method for objects of class lme

Here's a minimal example:

library(mice)
library(nlme)
dat <- nhanes
dat$id <- 1:5
imp <- mice(dat, maxit = 2, m = 2)
fit <- with(imp, exp = lme(bmi ~ age, random = ~1|id))
pool(fit)

I have already installed the developmental versions of mice and broom from github, but it didn't solve the problem.

stefvanbuuren commented 4 years ago

Thanks. Please add

library(broom.mixed)

and then it should work.

stefvanbuuren commented 3 years ago

Patrick D'Onofrio alerted me that library(broom.mixed) also solved error an Error in as.data.frame.default(data): cannot coerce class '"mids"' to a data.frame.