[R] compare posterior samples from R2OpenBugs and R function bugs{R2WinBUGS}

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Feb 19 14:18:05 CET 2013



On 18.02.2013 05:24, Jia Liu wrote:
> Hi all,
>
> I used both OpenBugs and R function bugs{R2WinBUGS} to run a linear mixed
> effects model based on the same data set and initial values. I got the same
> summary statistics but different posterior samples. However, if I order
> these two sets of samples, one is generated from OpenBugs and the other is
> generated from R, they turn to be the same. And the samples from R do not
> have any autocorrelation. I do not know why and how this R function destroy
> the orders of posterior samples. Have anyone ever met this situation
> before? Any idea is appreciated.

Not sure what you are looking at, since there is no reproducible example 
nor any code in your message.

However, I guess you came across a specific design decision by Andrew 
Gelman, who wrote some code of R2WinBUGS before it was turned into an R 
package. That feature is documented on the ?bugs help page:

"for convenience, the n.keep*n.chains simulations in sims.matrix and 
sims.list (but NOT sims.array) have been randomly permuted".

Best,
Uwe Ligges






>
> Thanks,
>
> Jia
>
>
>> sessionInfo()R version 2.15.1 (2012-06-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] R2WinBUGS_2.1-18 BRugs_0.8-0      coda_0.15-2      lattice_0.20-6
>
> loaded via a namespace (and not attached):
> [1] grid_2.15.1  tools_2.15.1
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list