You might consider the rlecuyer package, which provides parallel
streams and avoids the potential worst case scenario from arbitrary
seed setting.

On 5/25/05, Dr L. Y Hin <[EMAIL PROTECTED]> wrote:
> Dear all,
> Apologies for this pedantic question that only arise when there is hardware
> limitation.
> Setting: R 2.1.0 for windows xp sp2.
> Scenario:
> To generate 1000 samples using rnorm for a simulation activity.
> Background:
> The simulation activity requires so much memory resources that generating
> 200 samples
> clogs up the PF usage as indicated in the Windows Task Manager.
> Therefore, short of implementing the simulation on a computer with more
> resources,
> the alternative is to generate the 1000 samples in 5 separate runs,
> each generating 200 samples, closing the R window and re-opening between
> runs.
> Question to be addressed:
> To maintain consistency and ensure reproducibility of the simulation
> results, the 1000 samples
> generated in one single run should be indentical to the 5x200 samples
> generated on 5 separate
> runs.
> While such consistency can be ensured using set.seed()  in the case of one
> single run, in the case
> where 5 separate runs are performed, can we do the following to ensure
> identical samples being
> generated?
> 1. In the first run, specify the seed by, say, set.seed(1)
> 
> 2. At the end of the first run, store the .Random.seed by the following
> manner:
> saved.seed.1<-.Random.seed
> 
> 3. At the beginning of the second run, assign the saved.seed.1 to
> .Random.seed as follows:
> .Random.seed<-saved.seed.1
> 
> 4. At the end of the first run, store the new .Random.seed by the following
> manner:
> saved.seed.2<-.Random.seed
> 
> 5. At the beginning of the second run, assign the saved.seed.2 to
> .Random.seed as follows:
> .Random.seed<-saved.seed.2
> 
> This is repeated until 5 runs are completed.
> 
> Will the paths of random number generation be identical in these two
> approaches? If not, is there
> a way to ensure this?
> 
> Apologies again for this long-winded inquiry.
> 
> Thank you.
> Best
> Lin
> 
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 


-- 
best,
-tony

"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).

A.J. Rossini
[EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to