R/as.mcmc.list.bugs.R

Defines functions as.mcmc.list.bugs

as.mcmc.list.bugs <- function(x, ...)
{
    if(!inherits(x, "bugs")) 
        stop("Method as.mcmc.list.bugs() is only intended for bugs objects.")
    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 + 1
    end <- x$n.iter
    ord <- order(dimnames(x$sims.array)[[3]])
    for(i in 1:x$n.chains) {
        tmp1 <- x$sims.array[,i,ord]
        mclis[[i]] <- mcmc(tmp1, start=strt, end=end, thin=x$n.thin)
    }
    as.mcmc.list(mclis)
} 

Try the R2WinBUGS package in your browser

Any scripts or data that you put into this service are public.

R2WinBUGS documentation built on June 24, 2024, 5:18 p.m.