Multiple instances of R produce equal imputations with MICE - random seed issue?

785 views Asked by At

The multiple imputation packge mice uses a random number generator which can be set using the set.seed argument. I am running multiple instances of R (i.e. 3) in which the same data are imputed with the same mice arguments, where set.seed=NA which does not specify any seed value.

The three instances of R, however, produce exactly the SAME imputations. I am puzzled by this observation because I thought different instances of R should use different seed values when using set.seed=NA, but it appears they use the same. When I set set.seed manually, different imputations are produced.

My question is: is this plausible or may there be a computer (PC windows 7) problem that causes the seeds to be the same, even though I set set.seed=NA. I would welcome any thoughts on this problem.

By the way: I use multiple instances of R because the MICE function ibind() can be used to combine mids (multiply imputed data sets) objects. So it saves computing time on systems with multiple cores. This is of course nonsense if the same imputations are produced.

1

There are 1 answers

6
Sven Hohenstein On BEST ANSWER

If you use NULL as an argument for set.seed, the RNG will produce different results.

> set.seed(NULL)
> rnorm(5)
[1] -0.45861478 -0.56525262 -0.95349202  0.05073898 -1.01956671
> set.seed(NULL)
> rnorm(5)
[1]  0.57787302  3.27165390  0.53466909 -1.15390604 -0.02624054

I recommend using the sequence

set.seed(NULL)
mice(...) # without seed argument