DenCPD {frechet} | R Documentation |
Fréchet Change Point Detection for Densities
Description
Fréchet change point detection for densities with respect to
-Wasserstein distance.
Usage
DenCPD(
yin = NULL,
hin = NULL,
din = NULL,
qin = NULL,
supin = NULL,
optns = list()
)
Arguments
yin |
A matrix or data frame or list holding the sample of measurements
for the observed distributions. If |
hin |
A list holding the histograms for the observed distributions. |
din |
A matrix or data frame or list holding the density functions.
If |
qin |
A matrix or data frame or list holding the quantile functions.
If |
supin |
A matrix or data frame or list holding the support grids of
the density functions in |
optns |
A list of control parameters specified by
|
Details
Available control options are
- cutOff
A scalar between 0 and 1 indicating the interval, i.e., [cutOff, 1 - cutOff], in which candidate change points lie.
- Q
A scalar representing the number of Monte Carlo simulations to run while approximating the critical value (stardized Brownian bridge). Default is 1000.
- boot
Logical, also compute bootstrap
-value if
TRUE
. Default isFALSE
.- R
The number of bootstrap replicates. Only used when
boot
isTRUE
. Default is 1000.- nqSup
A scalar giving the number of the support points for quantile functions based on which the
Wasserstein distance (i.e., the
distance between the quantile functions) is computed. Default is 201.
- qSup
A numeric vector holding the support grid on [0, 1] based on which the
Wasserstein distance (i.e., the
distance between the quantile functions) is computed. It overrides
nqSup
.- bwDen
The bandwidth value used in
CreateDensity()
for density estimation; positive numeric - default: determine automatically based on the data-driven bandwidth selector proposed by Sheather and Jones (1991).- ndSup
A scalar giving the number of support points the kernel density estimation used in
CreateDensity()
; numeric - default: 101.- dSup
User defined output grid for the support of kernel density estimation used in
CreateDensity()
, it overridesndSup
.- delta
A scalar giving the size of the bin to be used used in
CreateDensity()
; numeric - default:diff(range(y))/1000
. It only works when the raw sample is available.- kernelDen
A character holding the type of kernel functions used in
CreateDensity()
for density estimation;"rect"
,"gauss"
,"epan"
,"gausvar"
,"quar"
- default:"gauss"
.- infSupport
logical if we expect the distribution to have infinite support or not, used in
CreateDensity()
for density estimation; logical - default:FALSE
- denLowerThreshold
FALSE
or a positive value giving the lower threshold of the densities used inCreateDensity()
; default:0.001 * mean(qin[,ncol(qin)] - qin[,1])
.
Value
A DenCPD
object — a list containing the following fields:
tau |
a scalar holding the estimated change point. |
pvalAsy |
a scalar holding the asymptotic |
pvalBoot |
a scalar holding the bootstrap |
optns |
the control options used. |
References
-
Dubey, P. and Müller, H.G., 2020. Fréchet change-point detection. The Annals of Statistics, 48(6), pp.3312-3335.
Examples
set.seed(1)
n1 <- 100
n2 <- 200
delta <- 0.75
qSup <- seq(0.01, 0.99, (0.99 - 0.01) / 50)
mu1 <- rnorm(n1, mean = delta, sd = 0.5)
mu2 <- rnorm(n2, mean = 0, sd = 0.5)
Y1 <- lapply(1:n1, function(i) {
qnorm(qSup, mu1[i], sd = 1)
})
Y2 <- lapply(1:n2, function(i) {
qnorm(qSup, mu2[i], sd = 1)
})
Ly <- c(Y1, Y2)
Lx <- qSup
res <- DenCPD(qin = Ly, supin = Lx, optns = list(boot = TRUE))
res$tau # returns the estimated change point
res$pvalAsy # returns asymptotic pvalue
res$pvalBoot # returns bootstrap pvalue