ccp_ppm {ppmSuite} | R Documentation |
Function that fits a multivariate correlated product partition change point model
Description
ccp_ppm
is a function that fits a Bayesian product partition change
point model, where the set of change point indicators between time series are correlated.
Usage
ccp_ppm(ydata, model=1,
nu0, mu0, sigma0,
mltypes, thetas,
devs,
nburn, nskip, nsave,
verbose = FALSE)
Arguments
ydata |
An |
model |
Determines of model fit is such that there are p_its (model=1) or only p_t (model=2) |
nu0 |
Degrees of freedom of the multivariate Student's t-distribution (see section Details). |
mu0 |
Location vector of dimension |
sigma0 |
Positive definite scale matrix of order |
mltypes |
Type of marginal likelihood. Currently only available is:
|
thetas |
An
|
devs |
An |
nburn |
The number of initial MCMC iterates to be discarded as burn-in. |
nskip |
The amount to thinning that should be applied to the MCMC chain. |
nsave |
Then number of MCMC iterates to be stored. |
verbose |
Logical indicating whether to print to screen the MCMC progression. The default value is |
Details
As described in Quinlan et al. (add cite), for each time series
:
Here, is a partition of
the set
into
contiguous blocks, and
. Also,
and
is a marginal
likelihood function which depends on the nature of
,
indexed by a hyperparameter
. In addition,
is the logit of a multivariate Student's t-distribution with degrees of
freedom
, location vector
and scale
matrix
.
Value
The function returns a list containing arrays filled with MCMC iterates
corresponding to model parameters. In order to provide more detail, in what
follows let be the number of MCMC iterates collected. The output list
contains the following:
C. An
matrix containing MCMC iterates associated with each series indicators of a change point. The
th row in
C
is divided intoblocks; the first
change point indicators for time series 1, the next
change point indicators for time series 2, and so on.
P. An
matrix containing MCMC iterates associated with each series probability of a change point. The
th row in
P
is divided intoblocks; the first
change point probabilities for time series 1, the next
change point probabilities for time series 2, and so on.
Examples
# Generate data that has two series, each with 100 observations
y1 <- replicate(25, rnorm(4, c(-1, 0, 1, 2), c(0.1, 0.25, 0.5, 0.75)))
y2 <- replicate(25, rnorm(4, c(2, 1, 0, -2), c(0.1, 0.25, 0.5, 0.75)))
y <- rbind(c(t(y1)), c(t(y2)))
# Marginal likelihood parameters
thetas <- matrix(1, nrow = 2,ncol = 4)
thetas[1,] <- c(0, 1, 2, 1)
thetas[2,] <- c(0, 1, 2, 1)
# M-H candidate density standard deviations
devs = matrix(0.1, nrow = 2, ncol = (dim(y)[2] - 1))
# Prior parameters for logit-t distribution
L <- nrow(y)
pivar <- 10
picorr <- 0.9
pimu <- rep(-6, L) # mean associated with logit of p_i
piSigma <- pivar*picorr*(rep(1, L) %*% t(rep(1, L))) +
pivar*(1 - picorr)*diag(L)
nu0 = 3
mu0 = pimu
sigma0 = piSigma
# Fit the bayesian ppm change point model
fit <- ccp_ppm(nburn = 1000, nskip = 1, nsave = 1000, ydata = y, nu0 = nu0,
mu0 = mu0, sigma0 = sigma0, mltypes = c(1, 1), thetas = thetas,
devs = devs)