Page 1 of 1

Pooling results using multiply imputated data (MICE)

Posted: Mon Nov 25, 2019 4:56 pm
by johnsphoughton
Hi there,

I am unable to pool results using data that has been multiply imputed using the MICE package and analysed using R2MLwiN.

Code: Select all

F1 <- bmi~1+(1|id)+(1|sweepage)

model1<-with(imp1, runMLwiN(Formula = F1))

The final line of code produces the following error: "No glance method for objects of class mlwinfitIGLS". On a previous on this forum ( ... dc6467b5a5) the poster mentions difficultly getting pooled estimates when using weights, but they state that pooling worked fine without weights, however this is not the case for me.

Please can anybody help?

Re: Pooling results using multiply imputated data (MICE)

Posted: Tue Nov 26, 2019 10:44 am
by ChrisCharlton
It appears that recent versions of mice have been changed so that they now rely on objects produced by the broom package instead of directly accessing the output of the coef and vcov functions. For more information see, and

The workaround would be to either use a version of mice prior to 3, or write a glance function that converts the R2MLwiN output into the expected format (see ... diers.html).

Re: Pooling results using multiply imputated data (MICE)

Posted: Tue Nov 26, 2019 11:09 am
by johnsphoughton
Hi Chris, thanks for your response. I have no experience writing functions so I don't think that route is possible for me. I guess I will have to look into working with an older version of mice, however I'm concerned that this may result in me not being able to impute my data using the methods I have used.

Re: Pooling results using multiply imputated data (MICE)

Posted: Tue Nov 26, 2019 2:02 pm
by ChrisCharlton
Looking at their example functions (e.g. ... -tidiers.R) the functions that you would need are something like:

Code: Select all

tidy.mlwinfitIGLS <- function(x, = FALSE, conf.level = .95, ...) {
    est <- coef(x)
    term <- names(est)
    sd <- sqrt(diag(vcov(x)))
    zscore <- est / sd
    pval <- 2 * stats::pnorm(abs(zscore), lower.tail = FALSE)
    ret <- tibble::tibble(term=term, estimate=est, std.error=sd, statistic=zscore, p.value=pval)

    if ( {
        conf <- plyr::unrowname(confint(x, level = conf.level))
        colnames(conf) <- c("conf.low", "conf.high")
        ret <- cbind(ret, conf)

glance.mlwinfitIGLS <- function(x, ...) {
      logLik = stats::logLik(x),
      AIC = stats::AIC(x),
      BIC = stats::BIC(x),
      df.residual = stats::df.residual(x), 
      nobs = stats::nobs(x)
Note that I have included AIC, BIC and df.residual to match their example and I do not know if these make sense in the multilevel context.