Learn R Programming

bcpmeta (version 1.0)

cp.plot: Plot a Changepoint Configuration

Description

Plot regimes-means (dashed line) against observational series (solid line).

Usage

cp.plot(results.parameter, meta.loc = NULL, cex = 1, file.name = NULL, ...)

Arguments

results.parameter
output of function bcpmeta.parameters, etimates of parameters in a certain changepoint configuration.
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.
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.parameters

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

## Parameter estimation in the configuration where changepoints are time 50 and 99.
results = bcpmeta.parameters(X, meta = meta, eta = c(50, 99), trend = FALSE);  

## Plot
cp.plot(results, meta.loc = -0.42, cex = 1.5);

Run the code above in your browser using DataLab