testData function

Test data with piecewise constant mean

Test data with piecewise constant mean

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

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

Returns

a list containing the following entries:

  • xa numeric vector containing a realisation of the piecewise time series model, given as signal + noise
  • mumean vector of piecewise stationary time series model
  • sigmascaling vector of piecewise stationary time series model
  • cptsa vector of change points in the piecewise stationary time series model

Details

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

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)

References

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

  • Maintainer: Haeran Cho
  • License: GPL (>= 3)
  • Last published: 2022-10-22

Useful links