single_SBS: Sparsified Binary Segmentation for single change-point...

View source: R/single_SBS.R

single_SBSR Documentation

Sparsified Binary Segmentation for single change-point estimation

Description

R wrapper for C function for single change-point estimation using Sparsified Binary Segmentation \insertCitecho_multiple-change-point_2015;textualHDCD.

Usage

single_SBS(
  X,
  threshold = NULL,
  rescale_variance = TRUE,
  empirical = FALSE,
  N = 100,
  tol = 1/100,
  debug = FALSE
)

Arguments

X

Matrix of observations, where each row contains a time series

threshold

Manually specified value of the threshold \pi_T

rescale_variance

If TRUE, each row of the data is re-scaled by a MAD estimate using rescale_variance

empirical

If TRUE, the threshold is based on Monte Carlo simulation

N

If empirical=TRUE, N is the number of Monte Carlo samples used

tol

If empirical=TRUE, tol is the false error probability tolerance

debug

If TRUE, diagnostic prints are provided during execution

Value

A list containing

pos

estimated change-point location

maxval

maximum thresholded and aggregated CUSUM at the estimated change-point position

References

\insertAllCited

Examples

# Single SBS
library(HDCD)
n = 50
p = 50
set.seed(101)
# Generating data
X = matrix(rnorm(n*p), ncol = n, nrow=p)
# Adding a single sparse change-point:
X[1:5, 26:n] = X[1:5, 26:n] +1

res = single_SBS(X,threshold=7,rescale_variance=TRUE)
res$pos

# Choose threhsold by Monte Carlo:
res = single_SBS(X,empirical=TRUE,rescale_variance=TRUE)
res$pos

HDCD documentation built on June 22, 2024, 10:53 a.m.