# cpRho: Test for Change-Point Detection Based on Spearman's Rho In npcp: Some Nonparametric CUSUM Tests for Change-Point Detection in Possibly Multivariate Observations

## Description

Nonparametric test for change-point detection particularly sensitive to changes in Spearman's rho in multivariate time series. 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 first reference.

## Usage

 ```1 2 3 4``` ```cpRho(x, method = c("mult", "asym.var"), statistic = c("pairwise", "global"), b = NULL, weights = c("parzen", "bartlett"), N = 1000, init.seq = NULL, include.replicates = FALSE) ```

## Arguments

 `x` a data matrix whose rows are multivariate continuous observations. `method` a string specifying the method for computing the approximate p-value for the test statistic; can be either `"mult"` (the multiplier approach 'tilde' 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 'mult' approach appears to lead to better behaved tests. `statistic` a string specifying the test statistic; can be either `"pairwise"` (the statistic S[n,3] in the first reference) or `"global"` (the statistic S[n,1] in the first reference). `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 == "mult"`, 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. `rho` the values of the `nrow(x)-1` intermediate change-point statistics; the test statistic is defined as the maximum of those. `b` the value of parameter `b`.

## Note

These tests were derived under the assumption of continuous margins.

## References

I. Kojadinovic, J-F. Quessy and T. Rohmer (2016), Testing the constancy of Spearman's rho in multivariate time series, Annals of the Institute of Statistical Mathematics 68:5, pages 929-954, http://arxiv.org/abs/1407.1624.

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.

`cpTau()` for a related test based on Kendall's tau, `cpDist()` for a related test based on the multivariate empirical d.f., `cpCopula()` for a related test based on the empirical copula.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```## Not run: 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 <- cpRho(x, b = 1) cp ## Estimated change-point which(cp\$rho == max(cp\$rho)) ## End(Not run) ```