bmdl.mean.shift: BMDL for Changepoint Detection

Description Usage Arguments Details Value References Examples

Description

For univiariate time series. It accomodates metadata (if any), and can handel monthly data and annual data.

Usage

1
2
3
4
5
6
bmdl.mean.shift(X, month = NULL, meta = NULL, iter = 10000,
  thin = max(1, iter/1000), type = "monthly", p = 3, fit = "marlik",
  penalty = "bmdl", nu = 5, a = 1, b1 = 19 * (type == "annual") + 239 *
  (type == "monthly"), b2 = (b1 - 4)/5, start.eta = NULL,
  track.time = TRUE, show.summary = 10, show.month = FALSE,
  start.year = 1)

Arguments

X

A vector of length N, observed time series data.

month

A vector of length N, month indicators. Takes value in 1, 2, ..., 12 for monthly data, or 1 for annual data.

meta

A 0-1 indicator vector of length N, metadata indicator. The first p elemenet are always 0.

iter

Total number of MCMC iterations.

thin

Thinning; save one MCMC iteration for every thin number of iterations.

type

Whether data are observed 'annual' or 'monthly'. Default is 'monthly'.

p

The order of the AR process.

fit

For likelihood calculation, 'marlik' for marginal likelihood, or 'lik' for likelihood. Note that the 'lik' option already includes the two-part MDL of mu.

penalty

For penalty function calculation, 'bmdl' for Beta-Binomial prior, or 'mdl' for MDL.

nu

Prior variance scale of mu; only used if fit == 'marlik'.

a

The first and second parameters in the Beta-Binomial prior; only used if penalty == 'bmdl'.

b1

The b parameter in the Beta-Binomial prior of η, for un-documented times (i.e., times not in metadata). Default value is 239 for monthly data, and 19 for annual data.

b2

The b parameter in the Beta-Binomial prior of η, for documented times (i.e., times in metadata). Default value is 47 for monthly data, and 3 for annual data.

start.eta

A 0-1 indicator vector of length N, initial changepoint model for MCMC. The first p elemenet are always 0. Default value is NULL.

track.time

Logical; whether to report processing time (in seconds).

show.summary

Integer; the number of top models to print. Default value is 10.

show.month

Logical; if show month in the summary. Default is FALSE.

start.year

Integer; the year time 1 is in. Default value is 1.

Details

Please see the references for more details.

Value

mcmc

A (iter / thin + 1) by (N + p + 2) matrix; each row is a saved MCMC output from an iteration, consisting eta, bmdl score, phi, and sigmasq.

map200

A 200 by (N + p + 2) matrix; the best 200 changepoint models visited. Each row is a model, consisting eta, bmdl score, phi, and sigmasq.

input.parameters

A list of all the following input parameters: X, month, meta, iter, thin, type, p, nu, a, b1, b2, period, and start.year.

References

Yingbo Li, Robert Lund, and Anuradha Hewaarachchi, "Multiple Changepoint Detection with Partial Information on Changepoint Times". Working paper.

Examples

1
2
3
4
5
6
7
data(tuscaloosa);
X = tuscaloosa[, 3];

## For illustration purpose, here iter is small.
## To get meaningfull inference, use a larger value, e.g., iter = 1e5.
results = bmdl.mean.shift(X, month = tuscaloosa[, 2], meta = tuscaloosa[, 7],
                          iter = 1e2);

yingboli/BayesMDL documentation built on May 29, 2019, 12:18 p.m.