Learn R Programming

distrEx (version 2.9.5)

CvMDist: Generic function for the computation of the Cramer - von Mises distance of two distributions

Description

Generic function for the computation of the Cramer - von Mises distance \(d_\mu\) of two distributions \(P\) and \(Q\) where the distributions are defined on a finite-dimensional Euclidean space \((\R^m,{\cal B}^m)\) with \( {\cal B}^m \) the Borel-\(\sigma\)-algebra on \(R^m\). The Cramer - von Mises distance is defined as $$d_\mu(P,Q)^2=\int\,(P(\{y\in\R^m\,|\,y\le x\})-Q(\{y\in\R^m\,|\,y\le x\}))^2\,\mu(dx)$$ where \(\le\) is coordinatewise on \(\R^m\).

Usage

CvMDist(e1, e2, ...)
# S4 method for UnivariateDistribution,UnivariateDistribution
CvMDist(e1, e2, mu = e1, useApply = FALSE, ..., diagnostic = FALSE)
# S4 method for numeric,UnivariateDistribution
CvMDist(e1, e2, mu = e1, ..., diagnostic = FALSE)

Value

Cramer - von Mises distance of e1 and e2

Arguments

e1

object of class "Distribution" or class "numeric"

e2

object of class "Distribution"

...

further arguments to be used e.g. by E()

useApply

logical; to be passed to E()

mu

object of class "Distribution"; integration measure; defaulting to e2

diagnostic

logical; if TRUE, the return value obtains an attribute "diagnostic" with diagnostic information on the integration, i.e., a list with entries method ("integrate" or "GLIntegrate"), call, result (the complete return value of the method), args (the args with which the method was called), and time (the time to compute the integral).

Methods

e1 = "UnivariateDistribution", e2 = "UnivariateDistribution":

Cramer - von Mises distance of two univariate distributions.

e1 = "numeric", e2 = "UnivariateDistribution":

Cramer - von Mises distance between the empirical formed from a data set (e1) and a univariate distribution.

Author

Matthias Kohl Matthias.Kohl@stamats.de,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

Details

Diagnostics on the involved integrations are available if argument diagnostic is TRUE. Then there is attribute diagnostic attached to the return value, which may be inspected and accessed through showDiagnostic and getDiagnostic.

References

Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.

See Also

ContaminationSize, TotalVarDist, HellingerDist, KolmogorovDist, Distribution-class

Examples

Run this code
CvMDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3),
                 mixCoeff=c(0.2,0.8)))
CvMDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3),
                 mixCoeff=c(0.2,0.8)),mu=Norm())
CvMDist(Norm(), Td(10))
CvMDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100))
CvMDist(Pois(10), Binom(size = 20)) 
CvMDist(rnorm(100),Norm())
CvMDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm())
CvMDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
CvMDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), mu = Pois())

Run the code above in your browser using DataLab