Learn R Programming

npcp (version 0.1-0)

cpTestRho: Test for change-point detection based on Spearman's rho

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

cpTestRho(x, method = c("mult", "asym.var"),
          statistic = c("pairwise", "global"),
          b = 1, weights = c("parzen", "bartlett"),
          N = 1000, init.seq = NULL)

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 e
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 6.1 of the second reference. The defaul
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 6.1 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.

Value

  • An object of class htest which is a list, some of the components of which are
  • statisticvalue of the test statistic.
  • p.valuecorresponding approximate p-value.
  • rhothe values of the nrow(x)-1 intermediate change-point statistics; the test statistic is defined as the maximum of those.
  • bthe value of parameter b.

Details

When method == "mult", the approximate p-value is computed as $$(0.5 +\sum_{i=1}^N\mathbf{1}_{{S_i\ge S}})/(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.

References

I. Kojadinovic, J-F. Quessy and T. Rohmer (2014), Testing the constancy of Spearman's rho in multivariate time series, http://arxiv.org/abs/1407.1624.

A. Bü{u}cher and I. Kojadinovic (2014), A dependent multiplier bootstrap for the sequential empirical copula process under strong mixing, http://arxiv.org/abs/1306.3930.

See Also

cpTestFn() for a related test based on the multivariate empirical c.d.f., cpTestCn() for a related test based on the empirical copula.

Examples

Run this code
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 <- cpTestRho(x)
cp
## estimated change-point
which(cp$rho == max(cp$rho))

Run the code above in your browser using DataLab