nsp_tvreg {nsp} | R Documentation |
Narrowest Significance Pursuit algorithm with general covariates
Description
This function runs the Narrowest Significance Pursuit (NSP) algorithm on data sequence y
and design matrix x
to return 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), 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 in the linear regression formulation y_t = beta(t) x_t + z_t are independent and
identically distributed Gaussians.
Usage
nsp_tvreg(
y,
x,
M = 1000,
thresh.val = NULL,
sigma = NULL,
alpha = 0.1,
power = 1/2,
min.size = 20,
overlap = FALSE
)
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. |
thresh.val |
Numerical value of the significance threshold (lambda in the paper); or |
sigma |
The standard deviation of the errors z_t; if |
alpha |
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). |
power |
A parameter for the MOLS estimator of sigma; the span of the moving window in the MOLS estimator is |
min.size |
(See immediately above.) |
overlap |
If |
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: |
threshold.used |
The threshold value. |
Author(s)
Piotr Fryzlewicz, p.fryzlewicz@lse.ac.uk
See Also
nsp
, nsp_poly
, nsp_poly_ar
, 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_tvreg(y, x, 100)