Nonparametric test for change-point detection based on the (multivariate) empirical distribution function. The observations can be continuous univariate or multivariate, and serially independent or dependent (strongly mixing). Approximate p-values for the test statistics are obtained by means of a multiplier approach. The first reference treats the serially independent case while details about the serially dependent case can be found in second and third references.
cpDist(x, statistic = c("cvmmax", "cvmmean", "ksmax", "ksmean"),
method = c("nonseq", "seq"), b = NULL, gamma = 0,
delta = 1e-4, weights = c("parzen", "bartlett"),
m = 5, L.method=c("max","median","mean","min"),
N = 1000, init.seq = NULL, include.replicates = FALSE)
An object of class
htest
which is a list,
some of the components of which are
value of the test statistic.
corresponding approximate p-value.
the values of the nrow(x)-1
intermediate
Cramér-von Mises change-point statistics.
the values of the nrow(x)-1
intermediate
Kolmogorov-Smirnov change-point statistics.
the values of all four test statistics.
the corresponding p-values.
the value of parameter b
.
a data matrix whose rows are continuous observations.
a string specifying the statistic whose value and
p-value will be displayed; can be either "cvmmax"
or
"cvmmean"
(the maximum or average of the nrow(x)-1
intermediate Cramér-von Mises statistics), or
"ksmax"
or "ksmean"
(the maximum or average of the
nrow(x)-1
intermediate Kolmogorov-Smirnov statistics); see
Section 3 in the first reference. The four statistics and the
corresponding p-values are computed at each execution.
a string specifying the simulation method for
generating multiplier replicates of the test statistic;
can be either "nonseq"
(the 'check' approach
in the first reference) or "seq"
(the 'hat' approach
in the first reference). The 'check' approach appears to lead to
better behaved tests and is recommended.
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
function bOptEmpProc()
; see the procedure described in
Section 5 of the second reference.
parameter between 0 and 0.5 appearing in the definition of the weight function used in the detector function.
parameter between 0 and 1 appearing in the definition of the weight function used in the detector function.
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.
a strictly positive integer specifying the number of points of the
uniform grid on \((0,1)^d\) (where \(d\) is
ncol(x)
) involved in the estimation of the bandwidth
parameter; see Section 5 of the third reference. The number of
points of the grid is given by m^ncol(x)
so that m
needs to be
decreased as \(d\) increases.
a string specifying how the parameter \(L\) involved in the estimation of the bandwidth parameter is computed; see Section 5 of the second reference.
number of multiplier replications.
a sequence of independent standard normal variates of
length N * (nrow(x) + 2 * (b - 1))
used to generate dependent
multiplier sequences.
a logical specifying whether the
object of class
htest
returned by the function
(see below) will include the multiplier replicates.
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.
M. Holmes, I. Kojadinovic and J-F. Quessy (2013), Nonparametric tests for change-point detection à la Gombay and Horváth, Journal of Multivariate Analysis 115, pages 16-32.
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, https://arxiv.org/abs/1306.3930.
A. Bücher, J.-D. Fermanian and I. Kojadinovic (2019), Combining cumulative sum change-point detection tests for assessing the stationarity of univariate time series, Journal of Time Series Analysis 40, pages 124-150, https://arxiv.org/abs/1709.02673.
cpCopula()
for a related test based on the empirical
copula, cpRho()
for a related test based on
Spearman's rho, cpTau()
for a related test based on
Kendall's tau, bOptEmpProc()
for the function used to
estimate b
from x
if b = NULL
,
seqClosedEndCpDist
for the corresponding sequential test.
## A univariate example
n <- 100
k <- 50 ## the true change-point
y <- rnorm(k)
z <- rexp(n-k)
x <- matrix(c(y,z))
cp <- cpDist(x, b = 1)
cp
## All statistics
cp$all.statistics
## Corresponding p.values
cp$all.p.values
## Estimated change-point
which(cp$cvm == max(cp$cvm))
which(cp$ks == max(cp$ks))
## A very artificial trivariate example
## with a break in the first margin
n <- 100
k <- 50 ## the true change-point
y <- rnorm(k)
z <- rnorm(n-k, mean = 2)
x <- cbind(c(y,z),matrix(rnorm(2*n), n, 2))
cp <- cpDist(x, b = 1)
cp
## All statistics
cp$all.statistics
## Corresponding p.values
cp$all.p.values
## Estimated change-point
which(cp$cvm == max(cp$cvm))
which(cp$ks == max(cp$ks))
Run the code above in your browser using DataLab