densdiff: Density Estimation at Zero of the Random Variable X - Y

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Estimates the density of the difference of two samples at 0. This is necessary for the Hodges-Lehmann (change point) test. See Dehling et al. (2015) for details.

Usage

1
2
3
densdiff(x, y, type2 = c("all", "within", "between"), adjust = 1, 
    kernelused = c("gaussian", "epanechnikov", "rectangular", 
    "triangular", "biweight","cosine", "optcosine"), ...)

Arguments

x

univariate numeric vector representing the first sample.

y

univariate numeric vector representing the second sample.

type2

character string indicating which differences should be used, to estimate the density. Must be one of 'all', 'within' and 'between', see Details.

adjust

numeric which determines the used bandwidth, see the help of density for Details.

kernelused

character string indicating the used kernel, see the help of density for Details.

...

further arguments passed to the respective internal functions.

Details

The Hodges-Lehmann two sample test requires an estimation of the density of the difference of both random variables X and Y at 0. This is also true for the the Hodges-Lehmann change point test since it consists of a sequence of two samples tests. One approach to estimate this density is to apply a kernel estimator at differences of values of both samples. This is basically the task of this function.

There are different possibilities to build differences:

If type2 is "all" one uses all possible differences of the merged sample.

If type2 is "within" one uses all possible differences within the first sample and all possible differences within the second.

If type2 is "between" one uses all possible differences between one observation of the first sample and one observation of the second.

The density estimation itself is computed by the function density of the stats package.

Value

The estimated density at 0.

Author(s)

Roland Fried and Alexander Dürre

References

Dehling, H., Fried, R., Wendler, M. (2015): A robust method for shift detection in time series, preprint. arXiv 1506.03345

See Also

The change point detection functions changerob and changerob.HL.

Examples

1
2
3
4
set.seed(1066)
x <- rnorm(100)
y <- rnorm(20)
densdiff(x, y)

robts documentation built on May 2, 2019, 4:55 p.m.