ESAC {HDCD} | R Documentation |
Efficient Sparsity Adaptive Change-point estimator
Description
R wrapper for C function implementing the full ESAC algorithm (see Moen et al. 2023).
Usage
ESAC(
X,
threshold_d = 1.5,
threshold_s = 1,
alpha = 1.5,
K = 5,
debug = FALSE,
empirical = FALSE,
tol = 0.001,
N = 1000,
thresholds = NULL,
thresholds_test = NULL,
threshold_d_test = threshold_d,
threshold_s_test = threshold_s,
fast = FALSE,
rescale_variance = TRUE,
trim = FALSE,
NOT = TRUE,
midpoint = FALSE
)
Arguments
X |
Matrix of observations, where each row contains a time series |
threshold_d |
Leading constant for |
threshold_s |
Leading constant for |
alpha |
Parameter for generating seeded intervals |
K |
Parameter for generating seeded intervals |
debug |
If |
empirical |
If |
tol |
If |
N |
If |
thresholds |
Vector of manually chosen values of |
thresholds_test |
Vector of manually chosen values of |
threshold_d_test |
Leading constant for |
threshold_s_test |
Leading constant for |
fast |
If |
rescale_variance |
If |
trim |
If |
NOT |
If |
midpoint |
If |
Value
A list containing
changepoints |
vector of estimated change-points |
changepointnumber |
number of changepoints |
CUSUMval |
the penalized score at the corresponding change-point in |
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 |
startpoints |
start point of the seeded interval detecting the corresponding change-point in |
endpoints |
end point of the seeded interval detecting the corresponding change-point in |
thresholds |
vector of values of |
thresholds_test |
vector of values of |
References
Moen PAJ, Glad IK, Tveten M (2023). “Efficient sparsity adaptive changepoint estimation.” Arxiv preprint, 2306.04702, https://doi.org/10.48550/arXiv.2306.04702.
Examples
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 ESAC:
res = ESAC(X)
res$changepoints
# Manually setting leading constants for \lambda(t) and \gamma(t)
res = ESAC(X,
threshold_d = 2, threshold_s = 2, #leading constants for \lambda(t)
threshold_d_test = 2, threshold_s_test = 2 #leading constants for \gamma(t)
)
res$changepoints #estimated change-point locations
# Empirical choice of thresholds:
res = ESAC(X, empirical = TRUE, N = 100, tol = 1/100)
res$changepoints
# Manual empirical choice of thresholds (equivalent to the above)
thresholds_emp = ESAC_calibrate(n,p, N=100, tol=1/100)
res = ESAC(X, thresholds_test = thresholds_emp[[1]])
res$changepoints