ChangepointDetector {ocd}R Documentation

Constructor for the ChangepointDetector S3 class

Description

Constructor for the ChangepointDetector S3 class

Usage

ChangepointDetector(dim, method = c("ocd", "Mei", "XS", "Chan"), thresh,
  patience = 5000, MC_reps = 100, beta = 1, sparsity = "auto",
  b = beta/sqrt(dim), p0 = 1/sqrt(dim), w = 200, lambda = sqrt(8) -
  2)

Arguments

dim

Data dimension, all new data must be of this dimension

method

Four methods are implemented: ocd, Mei, XS and Chan. They correspond to the methods proposed in Chen, Wang and Samworth (2020), Mei (2010), Xie and Siegmund (2013) and Chan (2017). The constructed detector will be of 'OCD', 'Mei', 'XS' and 'Chan' subclass respectively.

thresh

A numeric vector or the character string 'MC'. If 'MC' is specified then the correct threshold will be computed by Monte Carlo simulation (the patience argument should be specified for this). Otherwise, for method ocd, a vector of length 3 (corresponding to the diagonal statistic, off-diagonal dense statistic and off-diagonal sparse statistic) should be specifiied; for method Mei, a vector of length two (corresponding to the max and sum statistics) should be specified; for methods XS and Chan, a single positive real number should be specified;

patience

Required patience (average run length without change) of the online changepoint procedure. This is optional if the thresholds for detection are manually specified, but is required if Monte Carlo thresholds are used.

MC_reps

Number of Monte Carlo repetitions to use to estimate the thresholds. Only used when thresh='MC'.

beta

lower bound on the l_2 norm of the vector of mean change to be detected. This argument is used by the ocd method.

sparsity

Parameter used by the ocd. If sparsity='sparse', then only the diagonal and off-diagonal sparse statistics are used. If sparsity='dense', then only the diagonal and off-diagonal sparse statistics are used. If sparsity='auto', all three statistics are used to detect both sparse and dense change adaptively.

b

Lower bound on the per-coordinate magnitude of mean change be detected. This argument is used by the 'Mei' method. If b is unspecified but beta is specified, the default b = beta/sqrt(dim) will be used.

p0

A real number between 0 and 1. Sparsity parameter used by XS and Chan methods. It is the assumed fraction of nonzero coordinates of change. Default to 1/sqrt(dim).

w

Window size parameter used by XS and Chan methods. Number of most recent data points to keep track in memory. Default is 200.

lambda

A tuning parameter used by the Chan method. Default is sqrt(8)-2.

Details

This function is a wrapper. The new_OCD, new_Mei, new_XS and new_Chan carry out the actual constructor implementation.

Value

An object of S3 class 'ChangepointDetector'. Depending on the method argument specified, the object also belongs to a subclass 'OCD', 'Mei', 'XS' or 'Chan' corresponding to method='ocd'. It contains the following attributes:

References

See Also

accessor functions such as data_dim, the main function for processing a new data point getData, other methods for the ChangepointDetector class including reset, setBaselineMean, setBaselineSD, setStatus, normalisedStatistics and checkChange.

Examples

detector_ocd <- ChangepointDetector(dim=100, method='ocd',
                                    thresh=c(11.6, 179.5, 54.9), beta=1)
detector_Mei <- ChangepointDetector(dim=100, method='Mei',
                                    thresh=c(8.6, 125.1), b=0.1)
detector_XS <- ChangepointDetector(dim=100, method='XS', thresh=55.1)
detector_Chan <- ChangepointDetector(dim=100, method='Chan', thresh=8.7)

[Package ocd version 1.1 Index]