bmdl: Bayesian MDL (or MDL) for multiple changepoint detection

Description Usage Arguments Value

Description

Changes in both mean and linear trend, which permitting a global seasonal mean and AR(p) errors.

Usage

1
2
3
4
5
bmdl(x, dates, iter = 10000, thin = max(1, iter/1000), weights = NULL,
  p = 2, time_unit = "month", seasonal_means = "harmonic", k = 3,
  scale_trend_design = 0.05, fit = "marlik", penalty = "bmdl", nu = 5,
  kappa = 3, a = 1, b = 1, start_eta = NULL, start_xi = NULL,
  track_time = TRUE)

Arguments

x

The time series data, a numeric vector of length n.

dates

The dates records are observed, a POSIXlt vector. It should have the mon component for months, and the year component for years. See also strptime.

iter

Total number of MCMC iterations.

thin

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

weights

A numeric vector of observation weights, defined the same as the weights argument in the function lm.

p

The order of the AR process.

time_unit

Default is 'month' ('week' may be added in the future).

seasonal_means

The seasonal means variables in the linear model. Either 'fixed_effects' such that each season has a coefficient (with no intercept), or 'harmonic' for harmonic regression (with an intercept).

k

The highest degree of harmonic regression. It is only used if the argument seasonal_means == 'harmonic'.

scale_trend_design

The factor multiplied to the design matrix of trend. Default is 1/50.

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

kappa

Prior variance scale of outliers.

a

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

b

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

start_eta

A vector of 0/1 indicators for the initial model, or NULL to randomly sample an initial model.

start_xi

A vector of 0/1 indicators for the initial outliers, or NULL to randomly sample an initial model.

track_time

Logical, whether to show runtime on screen.

Value

best

The optimal model which minimizes BMDL or MDL; a list representing the model, which contains components: eta, inference (output of the fit_eta function), and change_eta.

eta_mcmc

A matrix to save MCMC iterations of eta. Each row is about an iteration, in the format of a vector of length n + p + 2, containing eta, bmdl, phi, sigmasq.

A

The design matrix for the nuisance coefficients in the linear model. It is usually the matrix of seasonal indicators, if the argument seasonal_means = 'fixed_effects', or the design matrix for harmonic regression with a column of all 1 for intercept, if the argument seasonal_means = 'harmonic').

runtime

Runtime, in second.

input_parameters

A list of input parameters.


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