TotalVarDist {distrEx}R Documentation

Generic function for the computation of the total variation distance of two distributions

Description

Generic function for the computation of the total variation distance d_v of two distributions P and Q where the distributions may be defined for an arbitrary sample space (Omega, A). The total variation distance is defined as

d_v(P,Q)=sup{|P(B)-Q(B)| | B in A}

Usage

TotalVarDist(e1, e2, ...)
## S4 method for signature 'AbscontDistribution,
##   AbscontDistribution':
TotalVarDist(e1,e2)
## S4 method for signature 'AbscontDistribution,
##   DiscreteDistribution':
TotalVarDist(e1,e2)
## S4 method for signature 'DiscreteDistribution,
##   AbscontDistribution':
TotalVarDist(e1,e2)
## S4 method for signature 'DiscreteDistribution,
##   DiscreteDistribution':
TotalVarDist(e1,e2)
## S4 method for signature 'numeric, DiscreteDistribution':
TotalVarDist(e1, e2)
## S4 method for signature 'DiscreteDistribution, numeric':
TotalVarDist(e1, e2)
## S4 method for signature 'numeric, AbscontDistribution':
TotalVarDist(e1, e2, asis.smooth.discretize = "discretize", 
            n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2),
            up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"))
## S4 method for signature 'AbscontDistribution, numeric':
TotalVarDist(e1, e2, asis.smooth.discretize = "discretize", 
            n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1),
            up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"))
## S4 method for signature 'AcDcLcDistribution,
##   AcDcLcDistribution':
TotalVarDist(e1, e2)

Arguments

e1 object of class "Distribution" or "numeric"
e2 object of class "Distribution" or "numeric"
asis.smooth.discretize possible methods are "asis", "smooth" and "discretize". Default is "discretize".
n.discr if asis.smooth.discretize is equal to "discretize" one has to specify the number of lattice points used to discretize the abs. cont. distribution.
low.discr if asis.smooth.discretize is equal to "discretize" one has to specify the lower end point of the lattice used to discretize the abs. cont. distribution.
up.discr if asis.smooth.discretize is equal to "discretize" one has to specify the upper end point of the lattice used to discretize the abs. cont. distribution.
h.smooth if asis.smooth.discretize is equal to "smooth" – i.e., the empirical distribution of the provided data should be smoothed – one has to specify this parameter.
... further arguments to be used in particular methods (not in package distrEx)

Details

In case we want to compute the total variation distance between (empirical) data and an abs. cont. distribution, we can specify the parameter asis.smooth.discretize to avoid trivial distances (distance = 1).

Using asis.smooth.discretize = "discretize", which is the default, leads to a discretization of the provided abs. cont. distribution and the distance is computed between the provided data and the discretized distribution.

Using asis.smooth.discretize = "smooth" causes smoothing of the empirical distribution of the provided data. This is, the empirical data is convoluted with the normal distribution Norm(mean = 0, sd = h.smooth) which leads to an abs. cont. distribution. Afterwards the distance between the smoothed empirical distribution and the provided abs. cont. distribution is computed.

Value

Total variation distance of e1 and e2

Methods

e1 = "AbscontDistribution", e2 = "AbscontDistribution":
total variation distance of two absolutely continuous univariate distributions which is computed using distrExIntegrate.
e1 = "AbscontDistribution", e2 = "DiscreteDistribution":
total variation distance of absolutely continuous and discrete univariate distributions (are mutually singular; i.e., have distance =1).
e1 = "DiscreteDistribution", e2 = "DiscreteDistribution":
total variation distance of two discrete univariate distributions which is computed using support and sum.
e1 = "DiscreteDistribution", e2 = "AbscontDistribution":
total variation distance of discrete and absolutely continuous univariate distributions (are mutually singular; i.e., have distance =1).
e1 = "numeric", e2 = "DiscreteDistribution":
Total variation distance between (empirical) data and a discrete distribution.
e1 = "DiscreteDistribution", e2 = "numeric":
Total variation distance between (empirical) data and a discrete distribution.
e1 = "numeric", e2 = "AbscontDistribution":
Total variation distance between (empirical) data and an abs. cont. distribution.
e1 = "AbscontDistribution", e1 = "numeric":
Total variation distance between (empirical) data and an abs. cont. distribution.
e1 = "AcDcLcDistribution", e2 = "AcDcLcDistribution":
Total variation distance of mixed discrete and absolutely continuous univariate distributions.

Author(s)

Matthias Kohl Matthias.Kohl@stamats.de,
Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de

References

Huber, P.J. (1981) Robust Statistics. New York: Wiley.

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

See Also

TotalVarDist-methods, ContaminationSize, KolmogorovDist, HellingerDist, Distribution-class

Examples

TotalVarDist(Norm(), Gumbel())
TotalVarDist(Norm(), Td(10))
TotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular
TotalVarDist(Pois(10), Binom(size = 20)) 

x <- rnorm(100)
TotalVarDist(Norm(), x)
TotalVarDist(x, Norm(), asis.smooth.discretize = "smooth")

y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5)
TotalVarDist(y, Norm())
TotalVarDist(y, Norm(), asis.smooth.discretize = "smooth")

TotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))

[Package distrEx version 2.0.5 Index]