This function runs the Narrowest Significance Pursuit (NSP) algorithm on a data sequence y believed to follow the model
Phi(B)y_t = f_t + z_t, where f_t is a piecewise polynomial of degree deg, Phi(B) is a characteristic polynomial of autoregression of order
ord with unknown coefficients, and z_t is noise. The function returns localised regions (intervals) of the domain, such that each interval
must contain a change-point in the parameters of the polynomial f_t, or in the autoregressive parameters,
at the global significance level alpha.
For any interval considered by the algorithm,
significant departure from parameter constancy is achieved if the multiscale
deviation measure (see Details for the literature reference) exceeds a threshold, which is either provided as input
or determined from the data (as a function of alpha). The function works best when the errors z_t are independent and
identically distributed Gaussians.
nsp_poly_ar(
y,
ord = 1,
M = 1000,
thresh.type = "univ",
thresh.val = NULL,
sigma = NULL,
alpha = 0.1,
deg = 0,
power = 1/2,
min.size = 20,
overlap = FALSE,
buffer = ord
)A vector containing the data sequence.
The assumed order of the autoregression.
The minimum number of intervals considered at each recursive stage, unless the number of all intervals is smaller, in which case all intervals are used.
"univ" if the significance threshold is to be determined as in Kabluchko (2007); "sim" for the degree-dependent
threshold determined
by simulation (this is only available if the length of y does not exceed 2150; for longer sequences obtain a suitable threshold by running
cov_dep_multi_norm_poly first).
Numerical value of the significance threshold (lambda in the paper); or NULL if the threshold is to be determined from
the data (see thresh.type).
The standard deviation of the errors z_t; if NULL then will be estimated from the data via the MOLS estimator described in the paper.
Desired maximum probability of obtaining an interval that does not contain a change-point (the significance threshold will be determined as a function of this parameter).
The degree of the polynomial pieces in f_t (0 for the piecewise-constant model; 1 for piecewise-linearity, etc.).
A parameter for the MOLS estimator of sigma; the span of the moving window in the MOLS estimator is min(n, max(round(n^power), min.size)),
where n is the length of y (minus ord).
(See immediately above.)
If FALSE, then on discovering a significant interval, the search continues recursively to the left and to the right of that
interval. If TRUE, then the search continues to the left and to the right of the midpoint of that interval.
A non-negative integer specifying how many observations to leave out immediately to the left and to the right of a detected interval of significance before recursively continuing the search for the next interval.
A list with the following components:
A data frame containing the estimated intervals of significance: starts and ends is where the intervals start and end,
respectively; values are the values of the deviation measure on each given interval; midpoints are their midpoints.
The threshold value.
The NSP algorithm is described in P. Fryzlewicz (2021) "Narrowest Significance Pursuit: inference for multiple change-points in linear
models", preprint. For how to determine the "univ" threshold, see Kabluchko, Z. (2007) "Extreme-value analysis of standardized Gaussian increments".
Unpublished.
# NOT RUN {
set.seed(1)
g <- c(rep(0, 100), rep(10, 100), rep(0, 100))
nsp_poly_ar(stats::filter(g + 2 * stats::rnorm(300), .5, "recursive"), thresh.type="sim")
# }
Run the code above in your browser using DataLab