single_SBS_calibrate {HDCD} | R Documentation |
Generates threshold \pi_T
for Sparsified Binary Segmentation for single change-point detection
Description
R wrapper for function choosing empirical threshold \pi_T
using Monte Carlo simulation for single change-point Sparsified Binary Segmentation. More specifically, the function returns the empirical upper tol quantile of CUSUMs over p
time series, each of length n
, based on N
number of runs.
Usage
single_SBS_calibrate(
n,
p,
N = 100,
tol = 1/100,
rescale_variance = TRUE,
debug = FALSE
)
Arguments
n |
Number of observations |
p |
Number time series |
N |
Number of Monte Carlo samples used |
tol |
False positive probability tolerance |
rescale_variance |
If TRUE, each row of the data is rescaled by a MAD estimate |
debug |
If TRUE, diagnostic prints are provided during execution |
Value
Threshold
Examples
library(HDCD)
n = 50
p = 50
set.seed(101)
# Simulate threshold
pi_T_squared = single_SBS_calibrate(n=n,p=p,N=100, tol=1/100, rescale_variance = TRUE)
pi_T_squared
# 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
# Run SBS
res = single_SBS(X,threshold=sqrt(pi_T_squared),rescale_variance=TRUE)
res$pos
[Package HDCD version 1.1 Index]