From: Uwe L. <li...@st...> - 2009-02-20 13:52:36
|
Gorjanc Gregor wrote: > Hi, > > Recently as.mcmc.list.bugs has been introduced as contrbuted by Mike Meredith. > I think there are some flaws. For example. I have an bugs object with the following details: > > 3 chains, each with 1e+05 iterations (first 10000 discarded), n.thin = 10 n.sims = 27000 iterations saved > > i.e. > > List of 24 > $ n.chains : num 3 > $ n.iter : num 1e+05 > $ n.burnin : num 10000 > $ n.thin : num 10 > $ n.keep : num 9000 > $ n.sims : num 27000 > > however, when I create an mcmc object I get > > List of 3 > $ : mcmc [1:9000, 1:59] 12 12.4 12.8 13.1 12.1 ... > ..- attr(*, "dimnames")=List of 2 > .. ..$ : chr [1:9000] "1001" "1002" "1003" "1004" ... > .. ..$ : chr [1:59] "alpha" "deviance" "l[10]" "l[11]" ... > ..- attr(*, "mcpar")= num [1:3] 1001 10000 1 > ... > > The last line, i.e., the mcpar, is wrong. It should be > > ..- attr(*, "mcpar")= num [1:3] 10001 100000 10 > > I also do not see the point in setting the rownames, since they are not reflecting the reality, i.e., > my chains where thinned, but the rownames are 1001, 1002, ... > > Bellow is the diff of the "fixed" function, but before I commit it, I would like to make sure > there is consensus about this. I could not find Mikes e-mail. Uwe? Thanks for the fix. I had not tested all possible cases, obviously. I'm fine with it, hence just commit unless anybody else objects. CCing Mike. Best, Uwe > Index: as.mcmc.list.bugs.R > =================================================================== > --- as.mcmc.list.bugs.R (revision 105) > +++ as.mcmc.list.bugs.R (working copy) > @@ -5,14 +5,14 @@ > if(dim(x$sims.array)[2] != x$n.chains) > stop("Inconsistancy in bug object regarding the number of chains.") > mclis <- vector("list", x$n.chains) > - strt <- x$n.burnin%/%x$n.thin + 1 > - end <- x$n.iter%/%x$n.thin > + strt <- x$n.burnin + 1 > + end <- x$n.iter > ord <- order(dimnames(x$sims.array)[[3]]) > - if(end - strt + 1 < nrow(x$sims.array[,1,ord])) end <- end + 1 > + ## This is not necedarry, since strt and end match dims of sims.array > + ## if(end - strt + 1 < nrow(x$sims.array[,1,ord])) end <- end + 1 > for(i in 1:x$n.chains) { > tmp1 <- x$sims.array[,i,ord] > - rownames(tmp1) <- strt:end > - mclis[[i]] <- mcmc(tmp1, strt, end, 1) > + mclis[[i]] <- mcmc(tmp1, start=strt, end=end, thin=x$n.thin) > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |