| print.bcp {bcp} | R Documentation |
print method for class bcp.
print.bcp(x, digits = max(3, .Options$digits - 3), ...)
x |
the result of a call to bcp(). |
digits |
an optional specification of 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
bcp, summary.bcp, and plot.bcp.
##### A random sample from a few normal distributions #####
testdata <- c(rnorm(50), rnorm(50, 5, 1), rnorm(50))
bcp.0 <- bcp(testdata)
print.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.
}