How many iterations does JAGS / BUGS save when burns and thinning are specified?

I have a quick question about the details of running a model in JAGS and BUGS.

Let's say I run a model with n.burnin=5000

, n.iter=5000

and thin=2

. Does this mean that the program will:

  • Run 5000 iterations and discard the results; and then
  • Run 10,000 more iterations, keeping only every second result?

If I save these simulations as an object CODA

, are they all saved in 10,000 or only subtle 5,000? I'm just trying to figure out what set of iterations is used to generate an ACF plot?

+3


source to share


2 answers


Using JAGS n.burnin=5000, n.iter=5000 and thin=2

means you don't hold anything. You run 5000, discard the first 5000 of those 5000, and then only keep half of the remaining chain values ​​(keep 1 value and discard the next).



Use for example n.burnin=2000, n.iter=7000, thin=50, n.chains=5

: so you have (7000-2000) / 50 * 5 = 500 values.

+2


source


Could you please clarify which software are you talking about? It looks like you are referring to the arguments to the bugs () function in the R2WinBUGS package (except the argument is named n.thin not thin). Looking for help (errors), it simply says that n.burnin is "the number of iterations to be discarded at the beginning". Which does not specifically answer your question, but looking at the source for bugs.script () in this package, it looks to me like it will run 5000 iterations, as you suspected. You can send a proposal to the parties to this package to clarify their documentation.

In your example, bugs () will then perform 0 further iterations after writing. The documentation is clear here - n.iter is the total number of iterations including burn.



For your second question, the CODA output from WinBUGS (and any software that calls WinBUGS or OpenBUGS) will only include a subtle sample.

0


source







All Articles