txtn: BMDL for Changepoint Detection, in Tmax / Tmin Joint...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
4
5
6
7
8
txtn(X, month = NULL, meta = NULL, iter = 10000, thin = max(1,
  iter/1000), type = "monthly", p = 3, nu = 5, alpha1 = c(3/7, 2/7, 2/7,
  19) * (type == "annual") + c(3/7, 2/7, 2/7, 239) * (type == "monthly"),
  alpha2 = c(3/7, 2/7, 2/7, 3) * (type == "annual") + c(3/7, 2/7, 2/7, 47) *
  (type == "monthly"), q = matrix(c(0, 1/2, 1/2, 1/2, 1/4, 0, 0, 1/4, 1/4, 0,
  0, 1/4, 1/2, 1/2, 1/2, 0), ncol = 4, nrow = 4), start.eta = NULL,
  track.time = TRUE, show.summary = 10, show.month = FALSE,
  start.year = 1)

Arguments

X

A N by 2 matrix, observed time series data. Columns are Tmax and Tmin, respectively.

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 VAR process.

nu

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

alpha1

The parameter in the Multinomial-Dirichlet prior of eta, for un-documented times (i.e., times not in metadata). Default value is c(3/7, 2/7, 2/7, 239) for monthly data, and c(3/7, 2/7, 2/7, 19) for annual data.

alpha2

The parameter in the Multinomial-Dirichlet prior of eta, for documented times (i.e., times in metadata). Default value is c(3/7, 2/7, 2/7, 47) for monthly data, and c(3/7, 2/7, 2/7, 3) for annual data.

q

A 4 by 4 transition matrix of the proposal distribution, only used in the flip proposal.

start.eta

A 0-1 indicator vector of length 2*N, initial changepoint model for MCMC. The entries correspond to the first p times 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.

Value

mcmc

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

map200

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

input.parameters

A list of all the following input parameters: X, month, meta, iter, thin, type, p, nu, alpha1, alpha2, q, period, and start.year.

Examples

1
2
3
4
5
6
data(tuscaloosa);
X = as.matrix(tuscaloosa[, 3:4]);

## For illustration purpose, here iter is small.
## To get meaningfull inference, use a larger value, e.g., iter = 5e4.
results = txtn(X, month = tuscaloosa[, 2], meta = tuscaloosa[, 7], iter = 1e1);

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