
Last chance! 50% off unlimited learning
Sale ends in
AsymTotalVarDist(e1, e2, ...)
## S3 method for class 'AbscontDistribution,AbscontDistribution':
AsymTotalVarDist(e1,e2, rho = 1,
rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000,
TruncQuantile = getdistrOption("TruncQuantile"),
IQR.fac = 15)
## S3 method for class 'AbscontDistribution,DiscreteDistribution':
AsymTotalVarDist(e1,e2, rho = 1, ...)
## S3 method for class 'DiscreteDistribution,AbscontDistribution':
AsymTotalVarDist(e1,e2, rho = 1, ...)
## S3 method for class 'DiscreteDistribution,DiscreteDistribution':
AsymTotalVarDist(e1,e2, rho = 1, ...)
## S3 method for class 'numeric,DiscreteDistribution':
AsymTotalVarDist(e1, e2, rho = 1, ...)
## S3 method for class 'DiscreteDistribution,numeric':
AsymTotalVarDist(e1, e2, rho = 1, ...)
## S3 method for class 'numeric,AbscontDistribution':
AsymTotalVarDist(e1, e2, rho = 1, asis.smooth.discretize = "discretize",
n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2),
up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"),
rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000,
TruncQuantile = getdistrOption("TruncQuantile"),
IQR.fac = 15)
## S3 method for class 'AbscontDistribution,numeric':
AsymTotalVarDist(e1, e2, rho = 1,
asis.smooth.discretize = "discretize",
n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1),
up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"),
rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000,
TruncQuantile = getdistrOption("TruncQuantile"),
IQR.fac = 15)
## S3 method for class 'AcDcLcDistribution,AcDcLcDistribution':
AsymTotalVarDist(e1, e2,
rho = 1, rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000,
TruncQuantile = getdistrOption("TruncQuantile"),
IQR.fac = 15)
"Distribution"
or "numeric"
"Distribution"
or "numeric"
"asis"
,
"smooth"
and "discretize"
. Default is "discretize"
.asis.smooth.discretize
is equal to
"discretize"
one has to specify the number of lattice points
used to discretize the abs. cont. distribution.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.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.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.distrExIntegrate
and uniroot
uniroot
e1
and e2
min(getLow(e1,eps=TruncQuantile),getLow(e2,eps=TruncQuantile))
,
max(getUp(e1,eps=TruncQuantile),getUp(e2,eps=TruncQuantile))
we determine
quantile based bounds c(low.0,up.0)
, and by means of
s1 <- max(IQR(e1),IQR(e2));
m1<- median(e1);
m2 <- median(e2)
and low.1 <- min(m1,m2)-s1*IQR.fac
, up.1 <- max(m1,m2)+s1*IQR.fac
we determine scale based bounds; these are combined by
low <- max(low.0,low.1)
, up <- max(up.0,up1)
.
Again in the absolutely continuous case, to determine the range of the
likelihood ratio, we evaluate this ratio on a grid constructed as follows:
x.range <- c(seq(low, up, length=Ngrid/3),
q(e1)(seq(0,1,length=Ngrid/3)*.999),
q(e2)(seq(0,1,length=Ngrid/3)*.999))
Finally, for both discrete and absolutely continuous case,
we clip this ratio downwards by 1e-10
and upwards by 1e10
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.TotalVarDist-methods
, ContaminationSize
,
KolmogorovDist
, HellingerDist
,
Distribution-class
AsymTotalVarDist(Norm(), Gumbel(), rho=0.3)
AsymTotalVarDist(Norm(), Td(10), rho=0.3)
AsymTotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100), rho=0.3) # mutually singular
AsymTotalVarDist(Pois(10), Binom(size = 20), rho=0.3)
x <- rnorm(100)
AsymTotalVarDist(Norm(), x, rho=0.3)
AsymTotalVarDist(x, Norm(), asis.smooth.discretize = "smooth", rho=0.3)
y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5)
AsymTotalVarDist(y, Norm(), rho=0.3)
AsymTotalVarDist(y, Norm(), asis.smooth.discretize = "smooth", rho=0.3)
AsymTotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), rho=0.3)
Run the code above in your browser using DataLab