cptRatio: Ratio method for covariance changepoint detection

Description Usage Arguments Details Value References See Also Examples

View source: R/cptRatio.R

Description

Implements the \insertCiteRyan2020;textualchangepoint.cov method for detecting covariance changes in multivariate time series. This method is aimed at independent high-dimensional time series.

Usage

1
2
3
4
5
6
7
8
9
cptRatio(
  X,
  threshold = "Asymptotic",
  numCpts = "AMOC",
  msl = 2 * ncol(X),
  thresholdValue = 0,
  errorCheck = TRUE,
  Class = TRUE
)

Arguments

X

Data matrix of dimension n by p.

threshold

Threshold choice for determining significance of changepoints. Choices include:

  • "Asymptotic" - Uses the asymptotic threshold derived for each method. For Ratio method the threshold is log(n). For CUSUM method the threshold is the specified quantile of the standard Normal distribution. The quantile is set by the argument thresholdValue.

  • "Manual"- A user chosen threshold which is contained in the thresholdValue argument. NOTE the normalized test statistics will be compared to the set thresholds - see details for more information.

If numCpts is numeric then the threshold is not used as the number of changepoints is known.

numCpts

Number of changepoints in the data. Choices include:

  • "AMOC" - At Most One Changepoint; test to see if the data contains a single changepoint or not.

  • "BinSeg"- Binary segmentation is performed to detect multiple changepoints.

  • Numeric - User specified number of changepoints.

msl

Minimum segment length allowed between the changepoints. NOTE this should be greater than or equal to p, the dimension of the time series.

thresholdValue

Either the manual threshold value when threshold="Manual" or the (1-thresholdValue)-quantile of asymptotic distribution of the test statistic when threshold="Asymptotic".

errorCheck

Logical. If TRUE error checking is performed

Class

Logical. If TRUE then an S4 class is returned. If FALSE the estimated changepoints are returned.

Details

This function calculates the test statistic, T, described in \insertCiteRyan2020;textualchangepoint.cov. Using results from Random Matrix Theory the test statistic is normalised by it's asymptotic expectation and variance so that it follows a standard Normal distribution. Following the paper, the threshold log(n) is used if the threshold is set as asymptotic, else the user defined manual threshold is used. If multiple changepoints are possible then the Binary Segmentation algorithm is used to detect multiple changes. If the minimum segment length is too small then the numerical integration performed in the normalization of the test statistic can be unstable. In this scenario the minimum segment length will be automatically increased. This method is designed for independent time series, if the time series contains temporal dependence we recommend using the cptCUSUM function.

Value

An object of S4 class cptCovariance is returned. If Class="FALSE", the vector of changepoints are returned.

References

\insertRef

Ryan2020changepoint.cov

See Also

cptCov, cptCovariance, wishartDataGeneration, ratioTestStat

Examples

1
2
3
4
5
6
7
8
set.seed(1)
dataAMOC <- wishartDataGeneration(n=100,p=5,tau=50)$data

ansRatio <- cptRatio(X=dataAMOC)
summary(ansRatio)

ansRatio2 <- cptCov(X=dataAMOC,threshold='Manual',numCpts='AMOC',msl=10,thresholdValue=20)
summary(ansRatio2)

grundy95/changepoint.cov documentation built on April 5, 2021, 6:21 p.m.