#' Calculate summaries from an MCMC run
#'
#' @param mcmc a data frame with MCMCtree's output
#'
#' @details
#' The data frame should have headers and should contain the output from the
#' mcmc.txt file generated by MCMCtree.
#'
#' @return
#' A data frame with the mean, median, and 95% CI of times
#'
#' @export
mcmc.sum <- function(mcmc) {
ti <- grep("t_", names(mcmc))
median <- apply(mcmc[,ti], 2, median)
mean <- apply(mcmc[,ti], 2, mean)
ci025 <- apply(mcmc[,ti], 2, quantile, probs=.025)
ci975 <- apply(mcmc[,ti], 2, quantile, probs=.975)
return(data.frame(median=median, mean=mean, ci025=ci025, ci975=ci975))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.