| single_SBS_calibrate | R Documentation | 
\pi_T for Sparsified Binary Segmentation for single change-point detectionR 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.
single_SBS_calibrate(
  n,
  p,
  N = 100,
  tol = 1/100,
  rescale_variance = TRUE,
  debug = FALSE
)
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  | 
Threshold
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.