Inspect {HDCD} | R Documentation |
Informative sparse projection for estimating change-points (Inspect)
Description
R wrapper for C function implementing a Narrowest-Over-Threshold variant of Inspect Wang and Samworth (2018) as specified in Appendix C in Moen et al. (2023). Note that the algorithm is only implemented for \mathcal{S} = \mathcal{S}_2
, in the notation of Moen et al. (2023).
Usage
Inspect(
X,
lambda = NULL,
xi = NULL,
alpha = 1.5,
K = 5,
eps = 1e-10,
empirical = FALSE,
maxiter = 10000,
N = 100,
tol = 1/100,
rescale_variance = TRUE,
debug = FALSE
)
Arguments
X |
Matrix of observations, where each row contains a time series |
lambda |
Manually specified value of |
xi |
Manually specified value of |
alpha |
Parameter for generating seeded intervals |
K |
Parameter for generating seeded intervals |
eps |
Threshold for declaring numerical convergence of the power method |
empirical |
If |
maxiter |
Maximum number of iterations for the power method |
N |
If |
tol |
If |
rescale_variance |
If |
debug |
If |
Value
A list containing
changepoints |
vector of estimated change-points |
changepointnumber |
number of changepoints |
CUSUMval |
vector with the sparse projected CUSUMs corresponding to |
coordinates |
a matrix of zeros and ones indicating which time series are affected by a change in mean, with each row corresponding to the change-point in |
scales |
vector of estimated noise level for each series |
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.
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)
# 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
# Vanilla Inspect:
res = Inspect(X)
res$changepoints
# Manually setting leading constants for \lambda(t) and \gamma(t)
res = Inspect(X,
lambda = sqrt(log(p*log(n))/2),
xi = 4*sqrt(log(n*p))
)
res$changepoints #estimated change-point locations
# Empirical choice of thresholds:
res = Inspect(X, empirical=TRUE, N = 100, tol = 1/100)
res$changepoints
# Manual empirical choice of thresholds (equivalent to the above)
thresholds_emp = Inspect_calibrate(n,p, N=100, tol=1/100)
res = Inspect(X, xi = thresholds_emp$max_value)
res$changepoints