w*******9 发帖数: 1433 | 1 Hi all, I am using the mclapply function in the multicore package in R. I am
doing a simulation study which requires 10000 replicates. How should I set
the seed so that the other people can reproduce my result? I tried the
following code but it gives me different output every time I run it.
set.seed(123)
mclapply(1:3, rnorm, mc.set.seed=T) | t*****w 发帖数: 254 | 2 set.seed(123)
x<-rnorm(10000)
mclapply(1:3, x, mc.set.seed=T)
am
set
【在 w*******9 的大作中提到】 : Hi all, I am using the mclapply function in the multicore package in R. I am : doing a simulation study which requires 10000 replicates. How should I set : the seed so that the other people can reproduce my result? I tried the : following code but it gives me different output every time I run it. : set.seed(123) : mclapply(1:3, rnorm, mc.set.seed=T)
| w*******9 发帖数: 1433 | 3 Thanks for your reply, but it doesnt work. I guess you mean I need to first
generate the data in the usual way and then pass the data to MY_FUNCTION.
That does not quite fit my need. I want to generate the random data in MY_
Function.
【在 t*****w 的大作中提到】 : set.seed(123) : x<-rnorm(10000) : mclapply(1:3, x, mc.set.seed=T) : : am : set
| l*********3 发帖数: 22 | 4 mc.set.seed=F
first
【在 w*******9 的大作中提到】 : Thanks for your reply, but it doesnt work. I guess you mean I need to first : generate the data in the usual way and then pass the data to MY_FUNCTION. : That does not quite fit my need. I want to generate the random data in MY_ : Function.
|
|