detect_cp_multi {BayesChange} | R Documentation |
Detect Change Points on multivariate time series
Description
Detect Change Points on multivariate time series
Usage
detect_cp_multi(
data,
n_iterations,
q,
k_0,
nu_0,
phi_0,
m_0,
par_theta_c = 1,
par_theta_d = 1,
prior_var_gamma = 0.1,
print_progress = TRUE,
user_seed = 1234L
)
Arguments
data |
a matrix where each row is a component of the time series and the columns correpospond to the times. |
n_iterations |
number of MCMC iterations. |
q |
probability of performing a split at each iteration. |
k_0 , nu_0 , phi_0 , m_0 |
parameters for the Normal-Inverse-Wishart prior for |
par_theta_c , par_theta_d |
parameters for the shifted Gamma prior for |
prior_var_gamma |
parameters for the Gamma prior for |
print_progress |
If TRUE (default) print the progress bar. |
user_seed |
seed for random distribution generation. |
Value
Function detect_cp_multi
returns a list containing the following components:
$orders
a matrix where each row corresponds to the output order of the corresponding iteration.time
computational time in seconds.$gamma_MCMC
traceplot for\gamma
.$gamma_MCMC_01
a0/1
vector, then
-th element is equal to1
if the proposed\gamma
was accepted,0
otherwise.$sigma_MCMC
traceplot for\sigma
.$sigma_MCMC_01
a0/1
vector, then
-th element is equal to1
if the proposed\sigma
was accepted,0
otherwise.$theta_MCMC
traceplot for\theta
.
Examples
data_mat <- matrix(NA, nrow = 3, ncol = 100)
data_mat[1,] <- as.numeric(c(rnorm(50,0,0.100), rnorm(50,1,0.250)))
data_mat[2,] <- as.numeric(c(rnorm(50,0,0.125), rnorm(50,1,0.225)))
data_mat[3,] <- as.numeric(c(rnorm(50,0,0.175), rnorm(50,1,0.280)))
out <- detect_cp_multi(data = data_mat,
n_iterations = 2500,
q = 0.25,k_0 = 0.25, nu_0 = 4, phi_0 = diag(1,3,3), m_0 = rep(0,3),
par_theta_c = 2, par_theta_d = 0.2, prior_var_gamma = 0.1)
get_clust_VI(out$order)