marginal.plot: Plot Posterior Marginal Inclusion Probabilities

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

View source: R/plots.R

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

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

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

Examples

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

Example output

10% completed...
20% completed...
30% completed...
40% completed...
50% completed...
60% completed...
70% completed...
80% completed...
90% completed...
100% completed.

Time used (in second): 
   user  system elapsed 
  3.697   0.012   3.752 

Top 5 changepoint configurations: 
50 85 106 153 
49 105 156 
55 105 151 
55 105 156 
50 105 125 157 189 

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