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

2013-02-19 Thread Jia Liu
On Tue, Feb 19, 2013 at 7:18 AM, Uwe Ligges lig...@statistik.tu-dortmund.de
 wrote:



 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.


Sorry for the inconvenience, I should have posted a sample code with it.


 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.

 It is exactly what I asked. I noticed that the posterior sample have been
randomly permuted. But I am curious the reason for doing that. So if the
autocorrelation is of my interest, I should use sims.array, not sims.list.

Thanks,

Jia



 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@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@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.


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

2013-02-17 Thread Jia Liu
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.

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@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.


[R] how to set the starting value in lme

2011-03-15 Thread jia liu
Hi,
When I fit the mixed-effects model by lme, I got theĀ convergence error code = 1
message = iteration limit reached without convergence (9). Even after I 
increase the iteration numbers, it still did not work. The only way I found to 
avoid the error message is to increase theĀ number of iterations for the EM 
algorithm, which need to be at least 1100. But the weird thing is that the 
correlation between two random coefficients is always around 1, which is not 
true. So I am thinking the error should be related with the improper starting 
value. But I do not know how to set up my desired starting value in lme 
function. Are there anybody know it? Or met the same problem with me before and 
know how to avoid the error? Thank you for your help.
Bests,
Jia


  
[[alternative HTML version deleted]]

__
R-help@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.