cptCov: Covariance changepoint detection

Description Usage Arguments Details Value References See Also Examples

View source: R/cptCov.R

Description

Finds covariance changepoints within multivariate time series data using either the Ratio method \insertCiteRyan2020changepoint.cov or a CUSUM based method \insertCiteAue2009changepoint.cov.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cptCov(
  X,
  method = c("Ratio", "CUSUM"),
  threshold = "Asymptotic",
  numCpts = "AMOC",
  msl = 2 * ncol(X),
  thresholdValue = 0.05,
  LRCov = "Bartlett",
  Class = TRUE
)

Arguments

X

Data matrix of dimension n by p.

method

Covariance changepoint method to be used. Choice of "Ratio" or "CUSUM".

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".

LRCov

The long-run covariance estimator to be used for CUSUM method. Currently, only "Bartlett" and "Empirical" are supported. Alternatively, a matrix containing the long-run covariance estimate can be inputted.

Class

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

Details

This is a simple wrapper function for the functions cptRatio and cptCUSUM. If no method is specified then the method used will depend on the dimension of the time series. For p<10, the CUSUM method will be used and for p>=10 the Ratio method will be used.

Value

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

References

\insertRef

Ryan2020changepoint.cov

\insertRef

Aue2009changepoint.cov

See Also

cptRatio, cptCUSUM, cptCovariance, wishartDataGeneration

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
set.seed(1)
dataAMOC <- wishartDataGeneration(n=100,p=3,tau=50)$data
dataMultipleCpts <- wishartDataGeneration(n=200,p=3,tau=c(50,100,150))$data

ansRatio <- cptCov(X=dataAMOC,method="Ratio")
summary(ansRatio)
plot(ansRatio)

ansCUSUM <- cptCov(X=dataAMOC,method='CUSUM')
show(ansCUSUM)

ansRatio2 <- cptCov(X=dataMultipleCpts,method='Ratio',threshold='Manual',numCpts='BinSeg',
		msl=10,thresholdValue=20)
summary(ansRatio2)
cptsSig(ansRatio2)
plot(ansRatio2)

ansCUSUM2 <- cptCov(X=dataAMOC,method='CUSUM',numCpts=3,
		msl=15,LRCov='Empirical')
summary(ansCUSUM2)
cptsSig(ansCUSUM2)

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