Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Dimitris Rizopoulos
do you want something like this: niter - 3 nchain - 2 rs - sample(500, niter, TRUE) for (i in 1:niter) { # iterations for (j in 1:nchain) { # chains set.seed(rs[i]) a - runif(1) cat(iter:, i, chain:, j, runif:, a, \n) } } I hope it helps. Best, Dimitris Dimitris Rizopoulos

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Duncan Murdoch
On 6/8/2005 9:27 AM, Gorjanc Gregor wrote: Hello! I am performing coupling of chains in MCMC and I need the same value of seed for two chains. I will show demo of what I want: R code, which might show my example is: niter - 3 nchain - 2 tmpSeed - 123 for (i in 1:niter) { # iterations for (j

RE: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Gorjanc Gregor
. -- -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: sre 2005-06-08 15:53 To: Gorjanc Gregor Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Random seed problem in MCMC coupling of chains On 6/8/2005 9:27 AM, Gorjanc Gregor wrote: Hello! I am performing coupling of chains

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Paul Gilbert
The tools in setRNG are intended for this kind of problem and I do use them regularly in much more complicated situations. They help save all the information, in addition to the seed, that you need for reproducible simulations. Try niter - 3 nchain - 2 for (i in 1:niter) { # iterations

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Paul Gilbert
To: Gorjanc Gregor Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Random seed problem in MCMC coupling of chains On 6/8/2005 9:27 AM, Gorjanc Gregor wrote: Hello! I am performing coupling of chains in MCMC and I need the same value of seed for two chains. I will show demo of what I want: R

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Gabor Grothendieck
. -- -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: sre 2005-06-08 15:53 To: Gorjanc Gregor Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Random seed problem in MCMC coupling of chains On 6/8/2005 9:27 AM, Gorjanc Gregor wrote: Hello! I am performing coupling

RE: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Gorjanc Gregor
Thanks to Paul and Gabor for additional tips/examples. Actually, I find Pauls suggestion with setRNG also nice and is exactly what I wanted. Paul, if I understand this correctly, your suggestion with setRNG does not alter RNG flow, it just takes care that chains really have equal seeds. I

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Gabor Grothendieck
Here is a small variation. We define a list to hold the last seed for each chain. Each time we enter the simulation for a chain we use that seed and each time we exit we update it. The loop becomes simpler since the setup is all done prior to looping and everything else is done in the inner

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Jan T. Kim
On Wed, Jun 08, 2005 at 12:55:07PM -0400, Gabor Grothendieck wrote: That could be addressed like this (where changing the offset changes the experiment). offset - 123 niter - 3 nchain - 2 for (i in 1:niter) { # iterations for (j in 1:nchain) { # chains set.seed(i+offset) a -

Re: [R] Random seed problem in MCMC coupling of chains

2005-06-08 Thread Kjetil Brinchmann Halvorsen
Gorjanc Gregor wrote: Thanks to Paul and Gabor for additional tips/examples. Actually, I find Pauls suggestion with setRNG also nice and is exactly what I wanted. Paul, if I understand this correctly, your suggestion with setRNG does not alter RNG flow, it just takes care that chains really