Learn R Programming

bcpmeta (version 1.0)

marginal.plot: Plot Posterior Marginal Inclusion Probabilities

Description

For each time point in the time series, the posterior probability of it being a changepoint time is computed using MCMC method and is plotted as height of the bar here.

Usage

marginal.plot(results.mcmc, meta.loc = NULL, cex = 1, burnin = 0.2, file.name = NULL, ...)

Arguments

results.mcmc
output of function bcpmeta.model, record of configurations that are visited by the MCMC.
meta.loc
the y-coordinate of the x-axis, for the purpose of mark crosses on the x-axis to indicate metadata locations; optional.
cex
width (size) of lines and lables.
burnin
the ratio of burnin length compared with the total length of MCMC. Estimates of posterior inclusion probabilites are calculated without burnin periods.
file.name
optional; if specified, then the plot is saved to a .ps file under this file name.
...
Arguments to be passed to methods, such as graphical parameters (see par).

Details

Metadata times are marked as crosses on the x-axis, if argument meta.loc is not NULL.

References

Li, Y. and Lund, R. (2014) Bayesian Mulitple Changepoint Detection Using Metadata. (submitted)

See Also

Function bcpmeta.model

Examples

Run this code
## Create a time series of length 200 with three mean shifts at 50, 100, 150.
data = simgen(2, 1);
X = data$X[1, ];  ## time series
meta = data$meta;  ## locations of metadata times

## For illustration purpose, number of MCMC iteration is set to a small value.
results = bcpmeta.model(X, meta = meta, iter = 1e3, trend = FALSE); 

marginal.plot(results, xlab = 'time', ylab = 'probability');

Run the code above in your browser using DataLab