Learn R Programming

BayesChange (version 2.1.3)

detect_cp_uni: Detect Change Points on an univariate time series.

Description

Detect Change Points on an univariate time series.

Usage

detect_cp_uni(
  data,
  n_iterations,
  q,
  a = 1,
  b = 1,
  c = 0.1,
  prior_var_phi = 0.1,
  prior_delta_c = 1,
  prior_delta_d = 1,
  print_progress = TRUE,
  user_seed = 1234L
)

Value

Function detect_cp_uni 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.

  • $sigma_MCMC traceplot for \(\sigma\).

  • $sigma_MCMC_01 a \(0/1\) vector, the \(n\)-th element is equal to \(1\) if the proposed \(\sigma\) was accepted, \(0\) otherwise.

  • $delta_MCMC traceplot for \(\delta\).

Arguments

data

vector of observations.

n_iterations

number of MCMC iteration.

q

probability of performing a split at each iterations.

a, b, c

parameters of the Normal-Gamma prior for \(\mu\) and \(\lambda\).

prior_var_phi

parameters for the correlation coefficient in the likelihood.

prior_delta_c, prior_delta_d

parameters of the shifted Gamma prior for \(\delta\).

print_progress

If TRUE (default) print the progress bar.

user_seed

seed for random distribution generation.

Examples

Run this code

data_vec <- as.numeric(c(rnorm(50,0,0.1), rnorm(50,1,0.25)))

out <- detect_cp_uni(data = data_vec,
                            n_iterations = 2500,
                            q = 0.25)


Run the code above in your browser using DataLab