nsp {nsp}R Documentation

Narrowest Significance Pursuit algorithm with general covariates and user-specified threshold

Description

This function runs the bare-bones Narrowest Significance Pursuit (NSP) algorithm on data sequence y and design matrix x to obtain localised regions (intervals) of the domain in which the parameters of the linear regression model y_t = beta(t) x_t + z_t significantly depart from constancy (e.g. by containing change-points). For any interval considered by the algorithm, significance is achieved if the multiscale supremum-type deviation measure (see Details for the literature reference) exceeds lambda. This function is mainly to be used by the higher-level functions nsp_poly, nsp_poly_ar and nsp_tvreg (which estimate a suitable lambda so that a given global significance level is guaranteed), and human users may prefer to use those functions instead; however, nsp can also be run directly, if desired. The function works best when the errors z_t in the linear regression formulation y_t = beta(t) x_t + z_t are independent and identically distributed Gaussians.

Usage

nsp(y, x, M, lambda, overlap = FALSE, buffer = 0)

Arguments

y

A vector containing the data sequence being the response in the linear model y_t = beta(t) x_t + z_t.

x

The design matrix in the regression model above, with the regressors as columns.

M

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.

lambda

The threshold parameter for measuring the significance of non-constancy (of the linear regression parameters), for use with the multiscale supremum-type deviation measure described in the paper.

overlap

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.

buffer

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.

Details

The NSP algorithm is described in P. Fryzlewicz (2021) "Narrowest Significance Pursuit: inference for multiple change-points in linear models", preprint.

Value

A list with the following components:

intervals

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 the midpoints of the intervals.

threshold.used

The threshold lambda.

Author(s)

Piotr Fryzlewicz, p.fryzlewicz@lse.ac.uk

See Also

nsp_poly, nsp_poly_ar, nsp_tvreg, nsp_selfnorm, nsp_poly_selfnorm

Examples

set.seed(1)
f <- c(1:100, 100:1, 1:100)
y <- f + stats::rnorm(300) * 15
x <- matrix(0, 300, 2)
x[,1] <- 1
x[,2] <- seq(from = 0, to = 1, length = 300)
nsp(y, x, 100, 15 * thresh_kab(300, .1))

[Package nsp version 1.0.0 Index]