Seed delivery to Stan does not guarantee the same chains

I was trying to compare the runtimes of two very equivalent but slightly different models. But chains will always take a very different time based on a sample of random numbers. So I tried to fix it by specifying the same parameter seed

to stan()

.

I have tried working with the same model two times. Unfortunately, I learned that even the same seed does not guarantee that the process will produce the same samples! And the running times of the chains in both runs are very different too!

100 iterations, 50 warmup, 15 chains

1st run: total 57.42 seconds, chain 14: 4.515 seconds, chain 15: 2.782 seconds; 
2nd run: total 76.99 seconds, chain 14: 2.703 seconds, chain 15: 4.125 seconds.

      

  • How is it possible that the seed doesn't guarantee the same chains in Stan?

  • How can this be guaranteed?

The following parameters were used to run Stan (version 2.5.0):

t1 <- proc.time()
out7.5b <- out <- stan(fit = fit7.5b, data = win.data, init = inits,
    pars = params,
      iter = ni, warmup = nb, chains = nc, seed = 123)
t2 <- proc.time()
print(t2 - t1)

      

+3


source to share





All Articles