Inspect | R Documentation |
R wrapper for C function implementing a Narrowest-Over-Threshold variant of Inspect \insertCitewang_high_2018;textualHDCD as specified in Appendix C in \insertCitemoen2023efficient;textualHDCD. Note that the algorithm is only implemented for \mathcal{S} = \mathcal{S}_2
, in the notation of \insertCitemoen2023efficient;textualHDCD.
Inspect(
X,
lambda = NULL,
xi = NULL,
alpha = 1.5,
K = 5,
eps = 1e-10,
empirical = FALSE,
maxiter = 10000,
N = 100,
tol = 1/100,
rescale_variance = TRUE,
debug = FALSE
)
X |
Matrix of observations, where each row contains a time series |
lambda |
Manually specified value of |
xi |
Manually specified value of |
alpha |
Parameter for generating seeded intervals |
K |
Parameter for generating seeded intervals |
eps |
Threshold for declaring numerical convergence of the power method |
empirical |
If |
maxiter |
Maximum number of iterations for the power method |
N |
If |
tol |
If |
rescale_variance |
If |
debug |
If |
A list containing
changepoints |
vector of estimated change-points |
changepointnumber |
number of changepoints |
CUSUMval |
vector with the sparse projected CUSUMs corresponding to |
coordinates |
a matrix of zeros and ones indicating which time series are affected by a change in mean, with each row corresponding to the change-point in |
scales |
vector of estimated noise level for each series |
library(HDCD)
n = 50
p = 50
set.seed(100)
# 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] +1
# Vanilla Inspect:
res = Inspect(X)
res$changepoints
# Manually setting leading constants for \lambda(t) and \gamma(t)
res = Inspect(X,
lambda = sqrt(log(p*log(n))/2),
xi = 4*sqrt(log(n*p))
)
res$changepoints #estimated change-point locations
# Empirical choice of thresholds:
res = Inspect(X, empirical=TRUE, N = 100, tol = 1/100)
res$changepoints
# Manual empirical choice of thresholds (equivalent to the above)
thresholds_emp = Inspect_calibrate(n,p, N=100, tol=1/100)
res = Inspect(X, xi = thresholds_emp$max_value)
res$changepoints
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.