cpU: Some CUSUM Tests for Change-Point Detection Based on...

Description Usage Arguments Details Value References See Also Examples

Description

Nonparametric CUSUM tests for change-point detection particularly sensitive to changes in certain quantities that can be estimated using one-sample U-statistics of order one or two. So far, the quantities under consideration are the expectation (thus corresponding to the standard CUSUM test based on the sample mean), the variance, Gini's mean difference, the autocovariance at a specified lag, the covariance for bivariate data and Kendall's tau for multivariate data. The observations can be serially independent or dependent (strongly mixing). Approximate p-values for the test statistic are obtained by means of a multiplier approach or by estimating the asymptotic null distribution. Details can be found in the first reference.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cpMean(x, method = c("nonseq", "seq", "asym.var"),
       b = NULL, weights = c("parzen", "bartlett"),
       N = 1000, init.seq = NULL, include.replicates = FALSE)

cpVar(x, method = c("nonseq", "seq", "asym.var"),
      b = NULL, weights = c("parzen", "bartlett"),
      N = 1000, init.seq = NULL, include.replicates = FALSE)

cpGini(x, method = c("nonseq", "seq", "asym.var"),
       b = NULL, weights = c("parzen", "bartlett"),
       N = 1000, init.seq = NULL, include.replicates = FALSE)

cpAutocov(x, lag = 1, method = c("nonseq", "seq", "asym.var"),
          b = NULL, weights = c("parzen", "bartlett"),
          N = 1000, init.seq = NULL, include.replicates = FALSE)

cpCov(x, method = c("nonseq", "seq", "asym.var"),
      b = NULL, weights = c("parzen", "bartlett"),
      N = 1000, init.seq = NULL, include.replicates = FALSE)

cpTau(x, method = c("seq", "nonseq", "asym.var"),
      b = NULL, weights = c("parzen", "bartlett"),
      N = 1000, init.seq = NULL, include.replicates = FALSE)

Arguments

x

a numeric vector or a data matrix containing continuous observations.

lag

an integer specifying at which lag to consider the autocovariance.

method

a string specifying the method for computing the approximate p-value for the test statistic; can be either "seq" (the 'check' approach in the first reference), "nonseq" (the 'hat' approach in the first reference), or "asym.var" (the approach based on the estimation of the asymptotic null distribution of the test statistic described in the first reference). The 'seq' approach appears overall to lead to better behaved tests for cpTau(). More experiments are necessary for the other functions.

b

strictly positive integer specifying the value of the bandwidth parameter determining the serial dependence when generating dependent multiplier sequences using the 'moving average approach'; see Section 5 of the second reference. The value 1 will create i.i.d. multiplier sequences suitable for serially independent observations. If set to NULL, b will be estimated from x using the procedure described in the first reference.

weights

a string specifying the kernel for creating the weights used in the generation of dependent multiplier sequences within the 'moving average approach'; see Section 5 of the second reference.

N

number of multiplier replications.

init.seq

a sequence of independent standard normal variates of length N * (nrow(x) + 2 * (b - 1)) used to generate dependent multiplier sequences.

include.replicates

a logical specifying whether the object of class htest returned by the function (see below) will include the multiplier replicates, if generated.

Details

When method is either "seq" or "nonseq", the approximate p-value is computed as

(0.5 + sum(S[i] >= S, i=1, .., N)) / (N+1),

where S and S[i] denote the test statistic and a multiplier replication, respectively. This ensures that the approximate p-value is a number strictly between 0 and 1, which is sometimes necessary for further treatments.

When method = "asym.var", the approximate p-value is computed from the estimated asymptotic null distribution, which involves the Kolmogorov distribution. The latter is dealt with reusing code from the ks.test() function; credit to RCore.

Value

An object of class htest which is a list, some of the components of which are

statistic

value of the test statistic.

p.value

corresponding approximate p-value.

u

the values of the nrow(x)-3 intermediate change-point statistics; the test statistic is defined as the maximum of those.

b

the value of parameter b.

References

A. Bücher and I. Kojadinovic (2016), Dependent multiplier bootstraps for non-degenerate U-statistics under mixing conditions with applications, Journal of Statistical Planning and Inference 170, pages 83-105, http://arxiv.org/abs/1412.5875.

A. Bücher and I. Kojadinovic (2016), A dependent multiplier bootstrap for the sequential empirical copula process under strong mixing, Bernoulli 22:2, pages 927-968, http://arxiv.org/abs/1306.3930.

See Also

cpDist() for a related test based on the multivariate empirical d.f., cpCopula() for a related test based on the empirical copula, cpAutocop() for a related test based on the empirical autocopula, cpRho() for a related test based on Spearman's rho, bOpt() for the function used to estimate b from x if b = NULL and seqCpMean for related sequential tests that can be used for online monitoring.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## The standard CUSUM test based on the sample mean
cp <- cpMean(c(rnorm(50), rnorm(50, mean=1)), b=1)
cp
## Estimated change-point
which(cp$statistics == cp$statistic)

## Testing for changes in the autocovariance
n <- 200
k <- n/2 ## the true change-point
x <- c(arima.sim(list(ar = -0.5), n = k),
       arima.sim(list(ar = 0.5), n = n - k))
cp <- cpAutocov(x)
cp
## Estimated change-point
which(cp$u == cp$statistic)
## Another example
x <- c(arima.sim(list(ar = c(0,-0.5)), n = k),
       arima.sim(list(ar = c(0,0.5)), n = n - k))
cpAutocov(x)
cp <- cpAutocov(x, lag = 2)
cp
## Estimated change-point
which(cp$u == cp$statistic)

## Not run: 
## Testing for changes in Kendall's tau
require(copula)
n <- 100
k <- 50 ## the true change-point
u <- rCopula(k,gumbelCopula(1.5))
v <- rCopula(n-k,gumbelCopula(3))
x <- rbind(u,v)
cp <- cpTau(x)
cp
## Estimated change-point
which(cp$u == cp$statistic)

## Testing for changes in the covariance
cp <- cpCov(x)
cp
## Estimated change-point
which(cp$u == cp$statistic)
## End(Not run)

Example output

	Test for change-point detection sensitive to changes in the
	expectation with 'method'="nonseq"

data:  c(rnorm(50), rnorm(50, mean = 1))
statistic = 2.4501, p-value = 0.0004995

stat51 
    51 

	Test for change-point detection sensitive to changes in the
	autocovariance at lag 1 with 'method'="nonseq"

data:  x
umax = 5.079, p-value = 0.008492

u99 
 98 

	Test for change-point detection sensitive to changes in the
	autocovariance at lag 1 with 'method'="nonseq"

data:  x
umax = 1.9875, p-value = 0.02647


	Test for change-point detection sensitive to changes in the
	autocovariance at lag 2 with 'method'="nonseq"

data:  x
umax = 4.5915, p-value = 0.02348

u88 
 87 
Loading required package: copula

	Test for change-point detection sensitive to changes in Kendall's tau
	with 'method'="seq"

data:  x
umax = 0.47231, p-value = 0.004496

u34 
 33 

	Test for change-point detection sensitive to changes in the covariance
	with 'method'="nonseq"

data:  x
umax = 0.085544, p-value = 0.1484

u34 
 33 

npcp documentation built on July 16, 2020, 5:07 p.m.

Related to cpU in npcp...