Pilliat_calibrate | R Documentation |
R wrapper for function choosing detection thresholds for the Dense, Partial sum and Berk-Jones statistics in the multiple change-point detection algorithm of \insertCitepilliat_optimal_2022;textualHDCD using Monte Carlo simulation. When Bonferroni==TRUE
, the detection thresholds are chosen by simulating the leading constant in the theoretical detection thresholds given in \insertCitepilliat_optimal_2022;textualHDCD, similarly as described in Appendix B in \insertCitemoen2023efficient;textualHDCD for ESAC. When Bonferroni==TRUE
, the thresholds for the Berk-Jones statistic are theoretical and not chosen by Monte Carlo simulation.
Pilliat_calibrate(
n,
p,
N = 100,
tol = 0.01,
bonferroni = TRUE,
threshold_bj_const = 6,
K = 2,
alpha = 1.5,
rescale_variance = TRUE,
test_all = FALSE,
debug = FALSE
)
n |
Number of observations |
p |
Number time series |
N |
Number of Monte Carlo samples used |
tol |
False error probability tolerance |
bonferroni |
If |
threshold_bj_const |
Leading constant for |
K |
Parameter for generating seeded intervals |
alpha |
Parameter for generating seeded intervals |
rescale_variance |
If |
test_all |
If |
debug |
If |
A list containing
thresholds_partial |
vector of thresholds for the Partial Sum statistic (respectively for |
threshold_dense |
threshold for the dense statistic |
thresholds_bj |
vector of thresholds for the Berk-Jones static (respectively for |
library(HDCD)
n = 50
p = 50
set.seed(100)
thresholds_emp = Pilliat_calibrate(n,p, N=100, tol=1/100)
thresholds_emp$thresholds_partial # thresholds for partial sum statistic
thresholds_emp$thresholds_bj # thresholds for Berk-Jones statistic
thresholds_emp$threshold_dense # thresholds for Berk-Jones statistic
set.seed(100)
thresholds_emp_without_bonferroni = Pilliat_calibrate(n,p, N=100, tol=1/100,bonferroni = FALSE)
thresholds_emp_without_bonferroni$thresholds_partial # thresholds for partial sum statistic
thresholds_emp_without_bonferroni$thresholds_bj # thresholds for Berk-Jones statistic
thresholds_emp_without_bonferroni$threshold_dense # thresholds for Berk-Jones statistic
# 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] +2
res = Pilliat(X, threshold_dense =thresholds_emp$threshold_dense,
thresholds_bj = thresholds_emp$thresholds_bj,
thresholds_partial =thresholds_emp$thresholds_partial )
res$changepoints
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.