Hi, list I am doing 100,000 iterations of Bayesian simulations. What I did is I split it into 4 different R sessions, each one runs 25,000 iteration. But two of the sessions gave the simulation result. I did not use any set.seed(). What is going on here? Thanks, Mike [[alternative HTML version deleted]]
Nordlund, Dan (DSHS/RDA)
2013-Feb-20 22:34 UTC
[R] Why R simulation gives same random results?
> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of C W > Sent: Tuesday, February 19, 2013 5:32 PM > To: r-help > Subject: [R] Why R simulation gives same random results? > > Hi, list > I am doing 100,000 iterations of Bayesian simulations. > > What I did is I split it into 4 different R sessions, each one runs > 25,000 > iteration. But two of the sessions gave the simulation result. > > I did not use any set.seed(). What is going on here? > > Thanks, > Mike >I may have missed it, but I haven't seen a response to this question yet. If no one has responded, it is probably because you haven't provided the code you used to run the simulation, or a reproducible example which demonstrates the problem. You say you didn't use set.seed(), but you didn't show what you did do, so there is insufficient information for anyone to be able to comment what went wrong. Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204
To know for sure we need to know how you are running these different R sessions, but here are some possibilities: The help page for "set.seed" says that if no seed exists then the seed is set based on the current time (and since 2.14.0 the process ID). So one possibility is that 2 of the sessions are started close enough together that they get the same seed. Or the difference in time and process ID cancel each other out. Another possibility (also mentioned in the help page) is that if the seed was saved in a previous session then it will be restored in the new session, if all the sessions are reading in the same stored session (or just the 2 that are the same) then they would start from the same seed. On Tue, Feb 19, 2013 at 6:31 PM, C W <tmrsg11@gmail.com> wrote:> Hi, list > I am doing 100,000 iterations of Bayesian simulations. > > What I did is I split it into 4 different R sessions, each one runs 25,000 > iteration. But two of the sessions gave the simulation result. > > I did not use any set.seed(). What is going on here? > > Thanks, > Mike > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Gregory (Greg) L. Snow Ph.D. 538280@gmail.com [[alternative HTML version deleted]]
Seemingly Similar Threads
- Floating simulation error
- Counterintuitive Simulation Results
- What package to use to calculate odds ratio and the confidence interval?
- [SPAM] - RE: REML with random slopes and random intercepts giving strange results - Bayesian Filter detected spam
- random number generator