Closed TobiasHeycke closed 5 years ago
What are you expecting the code to return? You only set the seed once. If I do this:
# run the code 10 times with the same seed
replicate(10,
{
set.seed(42)
ttestBF(
cars$dist - 30,
mu = 0,
posterior = TRUE,
iterations = 1000,
progress = FALSE
)
}, simplify = FALSE) -> samples
## Check to make sure they're all identical to the first
sapply(samples[-1],
function(el)
identical( el, samples[[1]] )
)
I get exactly the same thing on each run, because I'm setting the seed before each one. So as far as I can tell, the seed is being set.
I'm going to close this up; we can re-open it if you have a further issue.
Thanks Richard, that was my own stupidity inexperience using set.seed. In case others need, just like me, some more information on the working mechanisms of set.seed, they might find this helpful: https://stackoverflow.com/questions/20624698/fixing-set-seed-for-an-entire-session
When calculating an effect size (and corresponding HDI), the effect size (and HDI borders) cannot be reproduced, even when setting a seed. The following code should demonstrate it: