Learn R Programming

bcp (version 2.1.2)

print.bcp: Summarizing Bayesian change point results

Description

print method for class bcp.

Usage

print.bcp(x, digits = max(3, .Options$digits - 3), ...)

Arguments

x
the result of a call to bcp().
digits
an optional specification of the number of digits displayed in the summary statistics.
...
additional arguments.

Details

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.

See Also

bcp, summary.bcp, and plot.bcp.

Examples

Run this code
##### 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.
   }

Run the code above in your browser using DataLab