testData {mosum}R Documentation

Test data with piecewise constant mean

Description

Generate piecewise stationary time series with independent innovations and change points in the mean.

Usage

testData(
  model = c("custom", "blocks", "fms", "mix", "stairs10", "teeth10")[1],
  lengths = NULL,
  means = NULL,
  sds = NULL,
  rand.gen = rnorm,
  seed = NULL,
  ...
)

Arguments

model

a string indicating from which model a realisation is to be generated; possible values are "custom" (for user-specified model using lengths, means and sds), and "blocks", "fms", "mix", "stairs10", "teeth10" (for the referenced test signals)

lengths

use iff model = "custom"; an integer vector for the lengths of the piecewise stationary segments

means

use iff model = "custom"; a numeric vector for the means of the piecewise stationary segments

sds

use iff model = "custom"; a numeric vector for the deviation scaling of the piecewise stationary segments. The values are multiplied to the outcome of rand.gen, coinciding with the standard deviation in the case of standard normal innovations (rand.gen = rnorm)

rand.gen

optional; a function to generate the noise/innovations

seed

optional; if a seed value is provided (!is.null(seed)), then set.seed(seed) is called beforehand)

...

further arguments to be parsed to rand.gen

Details

See Appendix B in the reference for details about the test signals.

Value

a list containing the following entries:

References

P. Fryzlewicz (2014) Wild Binary Segmentation for Multiple Change-Point Detection. The Annals of Statistics, Volume 42, Number 6, pp. 2243-2281.

Examples

# visualise estimated changepoints by solid vertical lines
# and true changepoints by broken vertical lines
td <- testData(lengths = c(50, 50, 200, 300, 300), means = c(0, 1, 2, 3, 2.3), 
sds = rep(1, 5), seed = 123)
mbu <- multiscale.bottomUp(td$x)
plot(mbu, display = "data")
abline(v = td$cpts, col = 2, lwd = 2, lty = 2)

# visualise estimated piecewise constant signal by solid line
# and true signal by broken line
td <- testData("blocks", seed = 123)
mlp <- multiscale.localPrune(td$x)
plot(mlp, display = "data")
lines(td$mu, col = 2, lwd = 2, lty = 2)

[Package mosum version 1.2.7 Index]