#' Stan MCMC to coda
#'
#' Converts the output of a model fitted using rStan to a coda object. This then allows for statistics such as potential scale reduction factor to be computed using the coda library.
#' @param chain The MCMC chain to be converted
#' @export
stan2coda <- function(chain) {
coda_chain <- coda::mcmc.list(lapply(1:ncol(chain), function(x) coda::mcmc(as.array(chain)[,x,])))
return(coda_chain)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.