Inspect_calibrate {HDCD}R Documentation

Generates empirical detection threshold \xi using Monte Carlo simulation

Description

R wrapper for C function choosing empirical detection threshold \xi for the Narrowest-Over-Threshold variant of Inspect (as specified in section 4.2 in Moen et al. 2023) using Monte Carlo simulation.

Usage

Inspect_calibrate(
  n,
  p,
  N = 100,
  tol = 1/100,
  lambda = NULL,
  alpha = 1.5,
  K = 5,
  eps = 1e-10,
  maxiter = 10000,
  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

lambda

Manually specified value of \lambda (can be NULL, in which case \lambda \gets \sqrt{\log(p\log n)/2})

alpha

Parameter for generating seeded intervals

K

Parameter for generating seeded intervals

eps

Threshold for declaring numerical convergence of the power method

maxiter

Maximum number of iterations for the power method

rescale_variance

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

debug

If TRUE, diagnostic prints are provided during execution

Value

A list containing

max_value

the empirical threshold

References

Moen PAJ, Glad IK, Tveten M (2023). “Efficient sparsity adaptive changepoint estimation.” Arxiv preprint, 2306.04702, https://doi.org/10.48550/arXiv.2306.04702.

Examples

library(HDCD)
n = 50
p = 50

set.seed(100)
thresholds_emp = Inspect_calibrate(n,p, N=100, tol=1/100)
thresholds_emp$max_value # xi

# 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] +2

res = Inspect(X, xi = thresholds_emp$max_value)
res$changepoints

[Package HDCD version 1.0 Index]