cp.plot: Plot a Changepoint Configuration

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/plots.R

Description

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

Usage

1
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.

Author(s)

Yingbo Li

Maintainer: Yingbo Li <ybli@clemson.edu>

References

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

See Also

Function bcpmeta.parameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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);

Example output

100% completed.

Time used (in second): 
   user  system elapsed 
  0.112   0.008   0.142 

Estimates of parameters: 
phi: 0.3815
sigma2: 0.0258
mu: 0.0153 0.2461 0.4837 

bcpmeta documentation built on May 1, 2019, 6:48 p.m.