View source: R/changepoint_test_Pilliat.R
Pilliat_test | R Documentation |
R wrapper function testing for a single change-point using the three test statistics in the multiple change point detection algorithm of \insertCitepilliat_optimal_2022;textualHDCD. See also Appendix E in \insertCitemoen2023efficient;textualHDCD.
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
)
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 |
1 if a change-point is detected, 0 otherwise
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.