Inspect_test_calibrate {HDCD}R 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 Wang and Samworth (2018) 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

Wang T, Samworth RJ (2018). “High dimensional change point estimation via sparse projection.” Journal of the Royal Statistical Society: Series B (Statistical Methodology), 80(1), 57–83. ISSN 1467-9868, doi:10.1111/rssb.12243, https://rss.onlinelibrary.wiley.com/doi/abs/10.1111/rssb.12243.

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

[Package HDCD version 1.1 Index]