[R] R2WinBUGS results not different with different runs

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Thu Aug 9 07:20:02 CEST 2007


 <toby909 <at> gmail.com> writes:
> 
> Gregor Gorjanc wrote:
> >  <toby909 <at> gmail.com> writes:
> > 
> >>Is this a specialty with R2WinBUGS? Does it have something to do with the 
> >>seed value? Isnt the seed value reset everytime I restart winbugs?
> > 
> > I always have the same seed if I start WinBUGS multiple times.
> 
> So you get exactly the same chain, numerically, when rerunning the same 
>  model, with the same number of iterations, everything the same.?

I just tried now with Gelman's schools example from bugs() help page. I runned
the same job twice, with exactly the same initial values. Notes that WinBUGS
uses always the same starting seed. I got this

> schools.sim$last.values
[[1]]
[[1]]$theta
[1] 23.700 10.060 12.760 13.090  1.693 14.390  7.599  3.961

[[1]]$mu.theta
[1] 25.03

[[1]]$sigma.theta
[1] 20.08

....

> schools.sim2$last.values
[[1]]
[[1]]$theta
[1] 23.700 10.060 12.760 13.090  1.693 14.390  7.599  3.961

[[1]]$mu.theta
[1] 25.03

[[1]]$sigma.theta
[1] 20.08

> Wouldnt that be problematic if every researcher in the world who uses winbugs 
> uses the same sequence of random numbers?
> 
> R's random numbers are different each time, because the seed is linked to the 
> clock in your PC.

You can reset the seed if you want. Having the same seed is also nice for 
repeatability.

Gregor



More information about the R-help mailing list