xi_MH_flip: One MCMC iteration: propose to flip one random component of...

Description Usage Arguments Value

Description

One MCMC iteration: propose to flip one random component of xi

Usage

1
2
xi_MH_flip(x, A, current, p, fit, penalty, nu, kappa, a, b, scale_trend_design,
  weights)

Arguments

x

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

A

The design matrix for the nuisance coefficients in the linear model. It is usually the matrix of seasonal indicators, or the design matrix for harmonic regression with a column of all 1 for intercept.

current

A list object representing a changepoint model. It contains the following components: eta, xi, inference (output of the fit_eta function), change_eta, and change_xi.

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

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

scale_trend_design

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

weights

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

Value

A list object representing the (maybe) updated changepoint model.

eta

The (maybe) updated changepoint model, in the format of a vector of 0/1 indicators.

xi

The outliers, in the format of a vector of 0/1 indicators.

inference

Output of the fit_eta function on the output model eta.

change_eta

Logical, if this eta is new, i.e., the proposed model is accepted.

change_xi

Logical, if this xi is new, i.e., the proposed model is accepted.


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