| summary.bcp {bcp} | R Documentation |
summary method for class bcp.
summary.bcp(object, digits = max(3, .Options$digits - 3), ...)
object |
the result of a call to bcp(). |
digits |
the number of digits displayed in the summary statistics. |
... |
additional arguments. |
The function returns the posterior probability of a change point for each position, the posterior means and standard deviations. These results are modeled after the summary method of the coda package (Plummer et al., 2006). If return.mcmc=TRUE (i.e., if full MCMC results are returned), bcp objects can be converted into mcmc objects to view mcmc summaries – see examples below.
Chandra Erdman and John W. Emerson
Martyn Plummer, Nicky Best, Kate Cowles, and Karen Vines (2006), The coda Package, version 0.10-7, CRAN: The Comprehensive R Network.
##### A random sample from a few normal distributions #####
testdata <- c(rnorm(50), rnorm(50, 5, 1), rnorm(50))
bcp.0 <- bcp(testdata)
summary.bcp(bcp.0)
plot.bcp(bcp.0)
##### An MCMC summary from the ``coda'' package #####
if(require("coda")) {
bcp.0 <- bcp(testdata, return.mcmc=TRUE)
BURNIN <- bcp.0$burnin
M <- bcp.0$burnin + bcp.0$mcmc
bcp.mcmc <- as.mcmc(bcp.0$mcmc.means)
summary(bcp.mcmc)
heidel.diag(bcp.mcmc) # an example convergence diagnostic from the coda package.
}