6

I am trying to run a multiple imputation using the mice function (from the package of the same name) in R. I get a Warning that events have been logged. Here is the output from mice(.)$loggedEvents from my MWE (see below):

it im dep meth out
 1  1   X  pmm   H

I'm not sure what is causing this warning and what the implications are. From what I understand, this can be caused by collinearity amongst variables, but this should be prevented by using remove_collinear=FALSE, but this isn't fixing the Warning.

MWE:

Pop <- data.frame(X = c(   NA, 0.02, -1.15,  0.54, -0.61, -2.07),
                  Z = c( 0.83, 1.40, -3.07, -0.07, -0.20, -1.90),
                  D = c(    0,    0,     0,     1,     0,     0),
                  H = c( 0.01, 0.01,  0.01,  0.01,  0.02,  0.02))
Pop.Imp <- mice(Pop, m = 1, maxit = 1, print = T)

Obviously my original issue involved much more rows and columns of data and a higher number of imputations and iterations, but I've managed to trim this down to find this MWE.

Any help into figuring out what's causing this problem would be great. Is there some sort of cut-off that mice uses when deciding if/when a covariable is collinear? If it's very high, would this override the remove_collinear=FALSE parameter?

2 Answers2

2

This isn't a full answer, but I couldn't fit the reply in a comment.

The logged events warning can arise from a variety of issues. The issue raised can be identified from the "meth" column in the mice()$loggedEvents output.

The two issues I know of are collinearity, and a constant predictor across all values (or maybe constant across all missing/not missing also satisfied this criteria). Added some variables to highlight these:

Pop <- data.frame(X = c(   NA, 0.02, -1.15,  0.54, -0.61, -2.07,   NA),
                  Z1 = c( 0.83, 1.40, -3.07, -0.07, -0.20, -1.90, 2.00),
                  Z2 = c( 0.83, 1.40, -3.07, -0.07, -0.20, -1.90, 2.00),
                  D = c(    0,    0,     0,     1,     0,     0,    1),
                  H = c( 0.01, 0.01,  0.01,  0.01,  0.02,  0.02, 0.02))
Pop.Imp <- mice(Pop, m = 1, maxit = 1, print = T)

Pop.Imp$loggedEvents

  it im dep      meth out
1  0  0     collinear  Z2
2  1  1   X       pmm   H

Pop <- data.frame(X = c(   NA, 0.02, -1.15,  0.54, -0.61, -2.07,   NA),
                  Z1 = c( 0.83, 1.40, -3.07, -0.07, -0.20, -1.90, 2.00),
                  consvar = c( 0.83, 0.83, 0.83, 0.83, 0.83, 0.83, 0.83),
                  D = c(    0,    0,     0,     1,     0,     0,    1),
                  H = c( 0.01, 0.01,  0.01,  0.01,  0.02,  0.02, 0.02))
Pop.Imp <- mice(Pop, m = 1, maxit = 1, print = T)

Pop.Imp$loggedEvents

  it im dep     meth     out
1  0  0     constant consvar
2  1  1   X      pmm       H

Unfortunately I don't know what issue "pmm" is. Maybe something to do with the predictive mean matching (chosen imputation method) not able to work in such a small dataset?

AP30
  • 505
  • 7
  • 18
0

It says how many and which removals were made because of the used imputation method. The removal should be overriden by 'remove.collinear = FALSE' if the problem is collinearity but I do not think it is a wise idea to do so. You could also try to use another method for this variable.

Your output says that "H" was exluded as predictor from the imputation process for Xbecause of the method pmm.

pmm is the used method predictive mean matching.

The mice package also have a nice function to set predictors automatically, maybe this would solve the problem:

predictors <- qickpred(data)

imps <- mice(data = data, method = "pmm", predictorMatrix = predictors, m = 5, maxit = 1)

Another suggestion would be to check for the automatic methods and adapt them in the next step:

begin <- mice(data = data, maxit = 0)
meth <- begin$meth
View(as.matrix(meth))
meth[,c("X", "Z", "D"] <- "pmm"  

see also here: https://stefvanbuuren.name/fimd/sec-modelform.html

mascha
  • 1
  • 1