bcpmeta.parameters(X, meta, eta, iter = 10000, thin = 10, trend = TRUE, EB = TRUE, mu0 = NULL, nu0 = 5, phi.lower = -0.99, phi.upper = 0.99, sd.xi = 0.1, start.phi = NULL, burnin = 0.2, track.time = TRUE, show.summary = TRUE, start.year = 1, meta.year = FALSE, eta.year = FALSE)
X
,
or a numerical vector of the time indice of the metadata times.
X
,
or a numerical vector of the time indice of the changepoint times.
thin
number of iterations.
NULL
, set to the default value mean(X)
.
NULL
, generated randomly.
meta
is indexed in year,
if it consists of the locations of the metadata times (instead of 0-1 indicators).
eta
is indexed in year,
if it consists of the locations of the metadata times (instead of 0-1 indicators).
EB == TRUE
; or a vector of length (iter/thin)
, the MCMC samples of phi if EB == FALSE
. EB == TRUE
; or a vector of length (iter/thin)
, the MCMC samples of sigma2 if EB == FALSE
. (iter/thin)
, the MCMC samples of alpha if trend == TRUE
; or 0
if trend == FALSE
. (iter/thin)
* (sum(eta)+1)
matrix.
Each row is a MCMC sample of mu.EB == TRUE
; or the posterior mean if EB == FALSE
. EB == TRUE
; or the posterior mean if EB == FALSE
. sum(eta)+1
, posterior mean estimate of munames
to check
its components.EB == FALSE
.trend == TRUE
) is obtained via Gibbs sampler.
If EB == TRUE
, empirical Bayes estimates of sigma2 and phi are given; otherwise, fully Bayes estimates of them
are obtained via Gibbs sampler and Metropolis-Hastings algorithm, under Jeffreys prior and uniform prior respectively.
cp.plot
uses the output of this function as input.
## 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
## Parameter estimation in the configuration where changepoints are time 50 and 99.
results = bcpmeta.parameters(X, meta = meta, eta = c(50, 99), trend = FALSE);
Run the code above in your browser using DataLab