draw_rects_advanced {nsp} | R Documentation |
Plot NSP intervals of significance at appropriate places along the graph of data
Description
This function plots the intervals of significance returned by one of the nsp*
functions, at appropriate places along the graph of data.
It shows them as shaded rectangular areas (hence the name of the function) "attached" to the graph of the data. Note: the data sequence y
needs to have been plotted beforehand.
Usage
draw_rects_advanced(
y,
nsp.obj,
half.height = NULL,
show.middles = TRUE,
col.middles = "blue",
lwd = 3,
density = 10,
col.rects = "red",
x.axis.start = 1
)
Arguments
y |
The data. |
nsp.obj |
Object returned by one of the |
half.height |
Half-height of each rectangle; if |
show.middles |
Whether to display lines corresponding to the midpoints of the rectanlges (rough change-point location estimates). |
col.middles |
Colour of the midpoint lines. |
lwd |
Line width for the midpoint lines. |
density |
Density of the shading. |
col.rects |
Colour of the shading. |
x.axis.start |
Time index the x axis starts from. The NSP intervals of significance get shifted by |
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
Examples
set.seed(1)
f <- c(rep(0, 100), 1:100, rep(101, 100))
x.f <- f + 15 * stats::rnorm(300)
x.f.n <- nsp_poly(x.f, 100, "sim", deg=1)
stats::ts.plot(x.f)
draw_rects_advanced(x.f, x.f.n, density = 3)