library(HDCD)
n = 50
p = 50
# 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, 26:n] = X[1:5, 26:n] +1
# Vanilla Inspect:
resX = Inspect_test(X)
resX
resY = Inspect_test(Y)
resY
# Manually setting \lambda and \xi:
resX = Inspect_test(X,
lambda = sqrt(log(p*log(n))/2),
xi = 4*sqrt(log(n*p))
)
resX
resY = Inspect_test(Y,
lambda = sqrt(log(p*log(n))/2),
xi = 4*sqrt(log(n*p))
)
resY
# Empirical choice of thresholds:
resX = Inspect_test(X, empirical = TRUE, N = 100, tol = 1/100)
resX
resY = Inspect_test(Y, empirical = TRUE, N = 100, tol = 1/100)
resY
# Manual empirical choice of thresholds (equivalent to the above)
thresholds_test_emp = Inspect_test_calibrate(n,p, N=100, tol=1/100)
resX = Inspect_test(X, xi = thresholds_test_emp$max_value)
resX
resY = Inspect_test(Y, xi = thresholds_test_emp$max_value)
resY
Run the code above in your browser using DataLab