Closed jwb133 closed 1 year ago
Removing the
envir = globalenv()
part from the lastSeedValue get call seems to do the trick. Is there a reason why the lastSeedValue should get it from the global environment?
Thanks, Jonathan. This seems a good suggestion for when mice()
is called from within a function's environment. I expect that it will not have an effect on the intended behaviour in other frames. We'd have to test whether it does indeed not impact other scenarios.
Thanks, both.
Some other problems with local seeds surfaced over the last months. My plan is to drop it and restore the old situation.
I would very much favor that.
Thank you both. I will keep an eye out for when the restoration to the old behaviour happens.
Best wishes.
mice 3.14.12
works in the old way, using .Random.seed
from .GlobalEnv
. The local seed setting from #432 is gone.
I am using mice to perform some simulations. I have a function which calls mice, and in a certain situation, it calls mice some additional times to generate additional imputations. Since the recent change in mice's behaviour in terms of setting the seed back to where it was when mice was called, I have been using
.Random.seed <- imps$lastSeedValue
so that the seed does move on to where it 'got to' at the end of the call to mice.
However, this doesn't work as intended if the call to mice is from within a function (as I now have), since at the end of mice the line
is getting the seed from the global environment, which I guess is not the same seed value as within my function's local environment. I don't know what a/the solution is right now, but wanted to flag this up. Could one option be an additional argument which defaults to the current behaviour but let's the user specify for mice to not reset the seed back to its original value?
Personally I don't like the new behaviour of mice to set the seed back - it now differs in this respect I think to every other multiple imputation software.
Thanks all, Jonathan.