Skip to main content
Edit made by fileunderwater was approved in error: the chains have been run for 2000 iterations, not 1000, because 1000 iterations occurred in the jags.model function call.
Source Link
guy
  • 9.1k
  • 1
  • 34
  • 57

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 10002000 iterations each, and I have collected 100 samples from each chain, so that 400 samples are saved in total.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 1000 iterations each, and I have collected 100 samples from each chain, so that 400 samples are saved in total.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 2000 iterations each, and I have collected 100 samples from each chain, so that 400 samples are saved in total.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 20001000 iterations each, and I have collected 100 samples from each chain, forso that 400 total samples are saved in total.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 2000 iterations each, and I have collected 100 samples from each chain, for 400 total samples saved.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 1000 iterations each, and I have collected 100 samples from each chain, so that 400 samples are saved in total.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

added 191 characters in body
Source Link
guy
  • 9.1k
  • 1
  • 34
  • 57

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 2000 iterations each, and I have collected 100 samples from each chain, for 400 total samples saved.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different).

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", 1000, thin = 10)

Now all 4 of my chains have been run for a total of 2000 iterations each, and I have collected 100 samples from each chain, for 400 total samples.

Other answered is correct about BUGS but his answer does not apply to JAGS (at least, not to rjags, R2jags might be different). I haven't used JAGS directly, but the writer of rjags is the creator of JAGS so I would guess they use the same convention.

In rjags, the jags.model object keeps track of the number of iterations that the chain(s) have been run.

Here is a small model in a file "tmpJags":

model {
    X ~ dnorm(Y, 1)
    Y ~ dt(0, 1, 1)
}

Then I run

X <- 1
jm <- jags.model(file = "tmpJags", data = list(X = X), 
                 n.chains = 4, n.adapt = 1000)

jm consists of 4 chains, each of which has been run 1000 total iterations. Then I do

samps <- coda.samples(jm, "Y", n.iter = 1000, thin = 10)

Now all 4 of my chains have been run for a total of 2000 iterations each, and I have collected 100 samples from each chain, for 400 total samples saved.

To me, it makes sense to do it this way because for the purposes of monitoring chain convergence you would rather think in terms of total iterations than iterations after thinning.

Source Link
guy
  • 9.1k
  • 1
  • 34
  • 57
Loading