Inspect_test_calibrate: Generates empirical detection threshold xi for single...

View source: R/Inspect.R

Inspect_test_calibrateR Documentation

Generates empirical detection threshold \xi for single change-point testing using Monte Carlo simulation

Description

R wrapper for C function choosing the empirical detection threshold \xi for Inspect \insertCitewang_high_2018;textualHDCD for single change-point testing using Monte Carlo simulation.

Usage

Inspect_test_calibrate(
  n,
  p,
  N = 100,
  tol = 1/100,
  lambda = NULL,
  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})

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

\insertAllCited

Examples

library(HDCD)
n = 50
p = 50

set.seed(100)
thresholds_emp = Inspect_test_calibrate(n,p,N=100, tol=1/100)
thresholds_emp


# Generating data
X = matrix(rnorm(n*p), ncol = n, nrow=p)
Y = matrix(rnorm(n*p), ncol = n, nrow=p)

# Adding a single sparse change-point to X (and not Y):
X[1:5, 26:n] = X[1:5, 26:n] +2
resX = Inspect_test(X, xi = thresholds_emp$max_value)
resX
resY = Inspect_test(Y,  xi = thresholds_emp$max_value)
resY

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