-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid changing global .Random.seed #426
Comments
Thanks for your suggestion of a neater alternative. I created a branch context("mice: local random stream")
set.seed(1)
a <- runif(10)
set.seed(1)
b1 <- runif(6)
imp <- mice(nhanes, maxit = 0, seed = 82, print = FALSE)
imp2 <- mice.mids(imp, maxit = 1, print = FALSE)
b2 <- runif(4)
test_that("mice and mice.mids use a local random stream", {
expect_equal(a, c(b1, b2))
}) As long as the branch exists, install by devtools::install_github(repo = "amices/mice@randomseed") I did not look at the parallel functionality in the package. Does this work for you? |
PR #432 implements the local seed in the master version. |
Hi,
Would you consider using
withr::local_seed
inmice()
rather thanset.seed
?Currently
set.seed
sets.Random.seed
in the users' global environment which can result in unintended results and bugs.Regards,
Kenyon
The text was updated successfully, but these errors were encountered: