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
Run the code above in your browser using DataLab