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
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
.
--
-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
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
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
.
--
-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
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
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
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 -
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
10 matches
Mail list logo