Pilliat_test {HDCD} | R Documentation |
Pilliat single change-point test
Description
R wrapper function testing for a single change-point using the three test statistics in the multiple change point detection algorithm of Pilliat et al. (2023). See also Appendix E in Moen et al. (2023).
Usage
Pilliat_test(
X,
empirical = FALSE,
N = 100,
tol = 0.05,
thresholds_partial = NULL,
threshold_dense = NULL,
thresholds_bj = NULL,
threshold_d_const = 4,
threshold_bj_const = 6,
threshold_partial_const = 4,
rescale_variance = TRUE,
fast = FALSE,
debug = FALSE
)
Arguments
X |
Matrix of observations, where each row contains a time series |
empirical |
If |
N |
If |
tol |
If |
thresholds_partial |
Vector of manually specified detection thresholds for the partial sum statistic, for sparsities/partial sums |
threshold_dense |
Manually specified value of detection threshold for the dense statistic |
thresholds_bj |
Vector of manually specified detection thresholds for the Berk-Jones statistic, order corresponding to |
threshold_d_const |
Leading constant for the analytical detection threshold for the dense statistic |
threshold_bj_const |
Leading constant for |
threshold_partial_const |
Leading constant for the analytical detection threshold for the partial sum statistic |
rescale_variance |
If |
fast |
If |
debug |
If |
Value
1 if a change-point is detected, 0 otherwise
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.
Pilliat E, Carpentier A, Verzelen N (2023).
“Optimal multiple change-point detection for high-dimensional data.”
Electronic Journal of Statistics, 17(1), 1240 – 1315.
Examples
library(HDCD)
n = 200
p = 200
# 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, 100:200] = X[1:5, 100:200] +1
# Vanilla Pilliat test:
resX = Pilliat_test(X)
resX
resY = Pilliat_test(Y)
resY
# Manually setting leading constants for the theoretical thresholds for the three
# test statistics used
resX = Pilliat_test(X,
threshold_d_const=4,
threshold_bj_const=6,
threshold_partial_const=4
)
resX
resY = Pilliat_test(Y,
threshold_d_const=4,
threshold_bj_const=6,
threshold_partial_const=4
)
resY
# Empirical choice of thresholds:
resX = Pilliat_test(X, empirical = TRUE, N = 100, tol = 1/100)
resX
resY = Pilliat_test(Y, empirical = TRUE, N = 100, tol = 1/100)
resY
# Manual empirical choice of thresholds (equivalent to the above)
thresholds_test_emp = Pilliat_test_calibrate(n,p, N=100, tol=1/100,bonferroni=TRUE)
resX = Pilliat_test(X,
threshold_dense=thresholds_test_emp$threshold_dense,
thresholds_bj = thresholds_test_emp$thresholds_bj,
thresholds_partial = thresholds_test_emp$thresholds_partial
)
resX
resY = Pilliat_test(Y,
threshold_dense=thresholds_test_emp$threshold_dense,
thresholds_bj = thresholds_test_emp$thresholds_bj,
thresholds_partial = thresholds_test_emp$thresholds_partial
)
resY