-
Notifications
You must be signed in to change notification settings - Fork 1
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
Design not reproducible despite setting seed #55
Comments
Hi thanks for using the package. Could you share some code showing this? |
Hi IIrs thanks for your quick response. Here is some example code # Set seed
set.seed(123)
## mock dataframe
df <- data.frame(
Gender = sample(c("Male", "Female"), 50, replace = TRUE),
Age = sample(18:60, 50, replace = TRUE),
Column1 = sample(c(sample(1:100, 40, replace = TRUE), rep(NA, 10)), 50),
Column2 = sample(c(runif(40, 0, 50), rep(NA, 10)), 50),
Column3 = sample(c(sample(200:300, 40, replace = TRUE), rep(NA, 10)), 50),
Column4 = sample(c(rnorm(40, mean = 50, sd = 10), rep(NA, 10)), 50),
row.names = paste0("ID", 1:50)
)
index_1 <- experDesign::design(df, 13, iterations = 10000)
index_2 <- experDesign::design(df, 13, iterations = 10000)
setequal(index_1, index_2)
#[1] FALSE |
Of course, the seed must be set before any call that uses randomization. ## mock dataframe
df <- data.frame(
Gender = sample(c("Male", "Female"), 50, replace = TRUE),
Age = sample(18:60, 50, replace = TRUE),
Column1 = sample(c(sample(1:100, 40, replace = TRUE), rep(NA, 10)), 50),
Column2 = sample(c(runif(40, 0, 50), rep(NA, 10)), 50),
Column3 = sample(c(sample(200:300, 40, replace = TRUE), rep(NA, 10)), 50),
Column4 = sample(c(rnorm(40, mean = 50, sd = 10), rep(NA, 10)), 50),
row.names = paste0("ID", 1:50)
)
set.seed(123)
index_1 <- experDesign::design(df, 13, iterations = 10)
set.seed(123)
index_2 <- experDesign::design(df, 13, iterations = 10)
setequal(index_1, index_2) Note, I reduced the randomization as we don't really need iterations that long |
I see, thank you very much! |
Thanks for the package. Despite setting seed, I am getting different results every time I run design.
Many thanks for your help!
The text was updated successfully, but these errors were encountered: