MyNixOS website logo
Description

Bayesian Methods for Change Point Analysis.

Performs change point detection on univariate and multivariate time series (Martínez & Mena, 2014, <doi:10.1214/14-BA878> ; Corradin, Danese & Ongaro, 2022, <doi:10.1016/j.ijar.2021.12.019>) and clusters time-dependent data with common change points (Corradin, Danese, KhudaBukhsh & Ongaro, 2026, <doi:10.1007/s11222-025-10756-x>).

CRAN Status

BayesChange provides C++ functions to perform Bayesian change points analysis.

Installation

To install BayesChange the package devtools is needed.

install.packages("devtools")

Now BayesChange can be installed through the GitHub repository of the package:

devtools::install_github("lucadanese/BayesChange")

Package contents

The package contains two main functions:

  • detect_cp change points detection on time series and epidemic diffusions.
  • clust_cp clustering of time series or epidemic diffusions with common change points.

Additional methods and functions are included:

  • print() and summary() return information about the algorithm.
  • posterior_estimate() estimates the change points or the final partition of the data.
  • plot() provides a graphical representation of the results.
  • plot_psm() provides the posterior similarity matrix for the output of clust_cp.
  • sim_epi_data() generates an arbitrary number of simulated survival functions.

Detect change points

library(BayesChange)

## Univariate time series

data("stock_uni")

params_uni <- list(a = 1,
                   b = 1,
                   c = 1,
                   phi = 0.1)

out <- clust_cp(data = stock_uni[1:5,], n_iterations = 7500, n_burnin = 2500,
                L = 1, q = 0.5, B = 10000, params = params_uni, kernel = "ts")

print(out)
summary(out)
posterior_estimate(out)
plot(out)



## Multivariate time series

data("stock_multi")

params_multi <- list(m_0 = rep(0,2),
                     k_0 = 1,
                     nu_0 = 10,
                     S_0 = diag(1,2,2),
                     phi = 0.1)

out <- clust_cp(data = stock_multi[,,1:5], n_iterations = 7500, n_burnin = 2500,
                L = 1, B = 10000, params = params_multi, kernel = "ts")

print(out)
summary(out)
posterior_estimate(out)
plot(out)


## Epidemic diffusions

data("epi_synthetic_multi")

params_epi <- list(M = 250, xi = 1/8,
                   alpha_SM = 1,
                   a0 = 4,
                   b0 = 10,
                   I0_var = 0.1,
                   avg_blk = 2)

out <- clust_cp(epi_synthetic_multi, n_iterations = 5000, n_burnin = 2000,
                L = 1, B = 1000, params = params_epi, kernel = "epi")

print(out)
summary(out)
posterior_estimate(out)
plot(out)

Cluster time dependent data with common change points


## Univariate time series

data("stock_uni")

params_uni <- list(a = 1,
                   b = 1,
                   c = 1,
                   phi = 0.1)

out <- clust_cp(data = stock_uni[1:5,], n_iterations = 7500, n_burnin = 2500,
                L = 1, q = 0.5, B = 10000, params = params_uni, kernel = "ts")

print(out)
summary(out)
posterior_estimate(out)
plot(out)


## Multivariate time series

data("stock_multi")

params_multi <- list(m_0 = rep(0,2),
                     k_0 = 1,
                     nu_0 = 10,
                     S_0 = diag(1,2,2),
                     phi = 0.1)

out <- clust_cp(data = stock_multi[,,1:5], n_iterations = 7500, n_burnin = 2500,
                L = 1, B = 10000, params = params_multi, kernel = "ts")

print(out)
summary(out)
posterior_estimate(out)
plot(out)



## Epidemic diffusions

data("epi_synthetic_multi")

params_epi <- list(M = 250, xi = 1/8,
                   alpha_SM = 1,
                   a0 = 4,
                   b0 = 10,
                   I0_var = 0.1,
                   avg_blk = 2)

out <- clust_cp(epi_synthetic_multi, n_iterations = 5000, n_burnin = 2000,
                L = 1, B = 1000, params = params_epi, kernel = "epi")

print(out)
summary(out)
posterior_estimate(out)
plot(out)

Metadata

Version

2.3.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows