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 ESAC:
resX = ESAC_test(X)
resX
resY = ESAC_test(Y)
resY
# Manually setting leading constants for \lambda(t) and \gamma(t)
resX = ESAC_test(X,
threshold_d = 2, threshold_s = 2, #leading constants for \gamma(t)
)
resX
resY = ESAC_test(Y,
threshold_d = 2, threshold_s = 2, #leading constants for \gamma(t)
)
resY
# Empirical choice of thresholds:
resX = ESAC_test(X, empirical = TRUE, N = 100, tol = 1/100)
resX
resY = ESAC_test(Y, empirical = TRUE, N = 100, tol = 1/100)
resY
# Manual empirical choice of thresholds (equivalent to the above)
thresholds_test_emp = ESAC_test_calibrate(n,p, N=100, tol=1/100,bonferroni=TRUE)
resX = ESAC_test(X, thresholds = thresholds_test_emp[[1]])
resX
resY = ESAC_test(Y, thresholds = thresholds_test_emp[[1]])
resY
Run the code above in your browser using DataLab