Look at the harvestr package for one way to control multiple parallel
simulations and make sure that they have different seeds.


On Wed, Feb 20, 2013 at 4:24 PM, C W <tmrs...@gmail.com> wrote:

> Thanks, Greg.  I think you are right.  I did simulation one right after
> the other, less than 2 seconds.
>
> But still, it was shocking to see identical samples, which I had to throw
> away.
>
> As a rule of thumb, should I do simulation in one R console, rather than
> splitting the work into 2 consoles.  I just thought it would take less time
> for me, but it seems risky.
>
> Thanks,
>  Mike
>
>
>
> On Wed, Feb 20, 2013 at 6:13 PM, Greg Snow <538...@gmail.com> wrote:
>
>> 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 <tmrs...@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.
>> 538...@gmail.com
>>
>
>


-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

        [[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.

Reply via email to