amices / mice

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

parlmice: setting m and n.core results in m*n.core imputations #322

Closed Sim19 closed 3 years ago

Sim19 commented 3 years ago

Hi,

Could it be that when imputing with mice::parlmice() with m and n.core, one gets m * n.cores imputations? If that's so, a warning would be great in the help-file.

Thanks a lot for the great package!

gerkovink commented 3 years ago

Hi Simon,

I believe that the desired warning is communicated when relevant - i.e. when n.core is specified, but n.imp.core is not. See the below output for imp.

library(mice)
imp <- parlmice(nhanes, m = 5, n.core = 2)
#> Warning in parlmice(nhanes, m = 5, n.core = 2): Number of imputations per core
#> not specified: n.imp.core = m = 5 has been used
imp$m
#> [1] 10
imp1 <- parlmice(nhanes, n.imp.core = 3, n.core = 2)
imp1$m
#> [1] 6
imp2 <- parlmice(nhanes, m = 5)
imp2$m
#> [1] 5

Created on 2021-03-22 by the reprex package (v1.0.0)

For imp1 and imp2 there is no warning printed, as the algorithm either falls back to the default, or the argument n.imp.core is specified.

This is intentional and desired behaviour.

All the best,

Gerko

gerkovink commented 3 years ago

By the way; the default is n.core <- parallel::detectCores() - 1. This is also the fallback when n.imp.core is specified, but n.core is not.