draw_rects {nsp}R Documentation

Draw NSP intervals of significance as shaded rectangular areas on the current plot

Description

This function draws intervals of significance returned by one of the nsp* functions on the current plot. It shows them as shaded rectangular areas (hence the name of the function).

Usage

draw_rects(nsp.obj, yrange, density = 10, col = "red", x.axis.start = 1)

Arguments

nsp.obj

Object returned by one of the nsp* functions.

yrange

Vector of length two specifying the (lower, upper) vertical limit of the rectangles.

density

Density of the shading.

col

Colour of the shading.

x.axis.start

Time index the x axis starts from. The NSP intervals of significance get shifted by x.axis.start-1 prior to plotting.

Details

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

Value

The function does not return a value.

Author(s)

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

See Also

draw_rects_advanced, nsp

Examples

set.seed(1)
h <- c(rep(0, 150), 1:150)
x.h <- h + stats::rnorm(300) * 50
x.h.n <- nsp_poly(x.h, 1000, "sim", deg=1)
draw_rects(x.h.n, c(-100, 100))

[Package nsp version 1.0.0 Index]