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 |
use iff |
means |
use iff |
sds |
use iff |
rand.gen |
optional; a function to generate the noise/innovations |
seed |
optional; if a seed value is provided ( |
... |
further arguments to be parsed to |
Details
See Appendix B in the reference for details about the test signals.
Value
a list containing the following entries:
x a numeric vector containing a realisation of the piecewise time series model, given as signal + noise
mu mean vector of piecewise stationary time series model
sigma scaling vector of piecewise stationary time series model
cpts a vector of change points in the piecewise stationary time series model
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)