From: Uwe L. <li...@st...> - 2007-10-04 10:07:56
|
Gorjanc Gregor wrote: > A better idea would be top write a sample() method for > bugs class. This would be the most natural way in my > opinion. Sure, that would be much cleaner code, but it might break code of people using the package. Even if the original design decision is R-unlike (and it was my fault not to change it - and insist on such a change - while moving Andrew's code into an R package), we should stay with it, I think. Note that it is also documented for quite a long time now. ?bugs tells us: sims.matrix matrix of simulation output, with n.chains*n.keep rows and one column for each element of each saved parameter (for convenience, the n.keep*n.chains simulations in sims.matrix and sims.list (but NOT sims.array) have been randomly permuted) Best, Uwe > sample(bugs) > ... > ________________________________________ > From: bug...@li... [bug...@li...] On Behalf Of Andrew Gelman [ge...@st...] > Sent: Thursday, October 04, 2007 12:55 AM > To: Anon. > Cc: bug...@li... > Subject: Re: [Bugs-r-devel] R2WinBUGS bug fix > > I'm confused because bugs has sims.list, sims.matrix, and sims.array, > but I don't see sims. In the ?bugs help, it says that "for convenience, > the 'n.keep * n.chains' simulations in sims.matrix and sims.list (but > NOT sims.array) have been randomly permuted" > > The reason why we scramble the simulations is so we can more easily > access random draws from the posterior distribution. We can then just > use the first 10 simulations or the first 100 or whatever to do > posterior simulations (see chapter 6 of BDA for various examples). > > Checking for convergence--which is the same thing as assessing > mixing--isn't a problem since we check convergence on the unscrambled > series that are in sims.array. You can always use sims.array if you > want to work with these. > > Andrew > > Anon. wrote: >> Uwe Ligges wrote: >>> I think this was proposed by Andrew Gelman in the original code and I >>> already had the discussion but forgot the outcome (people would like >>> to have it randomized?, Andrew?). >>> >>> Anyway, a fix would be to add drop = FALSE as in >>> >>> sims <- sims [sample(n.sims), , drop = FALSE] # scramble (for >>> convenience in analysis) >>> >>> >> I'm curious - how can you check for convergence if the order is >> randomised? I'm thinking of cases where both chains are moving in the >> same direction towards the part of the posterior with high probability >> mass. It also makes mixing more difficult to assess, although this is >> less critical. >> >> I would certainly prefer not to have this randomised - there are >> disadvantage, and if you want the results randomise, it's easy to do >> (hey, it's one line of code!). OTOH, if it's already randomised, it's >> difficult to impossible to unscramble it. >> >> Bob >> > > -- > Andrew Gelman > Professor, Department of Statistics > Professor, Department of Political Science > Director, Applied Statistics Center > Columbia University, New York > ge...@st... > www.stat.columbia.edu/~gelman > > Usual schedule: > > Mon, Tues, Fri in Statistics Dept ofc: > Social Work Bldg (Amsterdam Ave at 122 St), Room 1016 > phone 212-851-2142, fax 212-851-2164 > Wed, Thurs in Political Science Dept ofc: > International Affairs Bldg (Amsterdam Ave at 118 St), Room 731 > phone 212-854-7075, fax 212-222-0598 > Wed, Thurs from 2:30pm onward in Playroom: > International Affairs Bldg, Room 707 > > I'm out of town 11-12 Oct, 26 Oct, and 15-23 Nov. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |