
Kolmogorov distance between a characteristic-function target and a mixture
Source:R/from_cf.R
gmm_cf_distance.RdFor a direction \(a\), compares the distribution of \(a^\top X\) under the target with its distribution under the mixture and returns a lower and an upper bound for the largest absolute difference between the two distribution functions (the Kolmogorov distance). The differences are obtained by numerical inversion of the two characteristic functions (Gil-Pelaez, 1951), so neither distribution is sampled.
Usage
gmm_cf_distance(
g,
cf,
direction = NULL,
n_grid = 201L,
probs = c(0.005, 0.995)
)Arguments
- g
- cf
The target's characteristic function, as in
from_cf().- direction
Numeric vector with one entry for each dimension of
g, not all zero. Default: the first coordinate axis.- n_grid
Number of grid points. Default
201L.- probs
The lowest and highest probability of the grid. Default
c(0.005, 0.995).
Value
A list with distance (the largest difference on the grid),
at (the grid point where it is attained), upper (the upper bound
described above), upper_inside (the bound between the two quantiles
in probs), truncation (a bound on the omitted part of the inversion
integral from the highest frequency integrated to 20 times that
frequency, added to upper and upper_inside; the part beyond is
ignored), x (the grid), difference (target minus
mixture distribution function at each grid point), and cutoff_gap
(the modulus of the difference between the two characteristic
functions at the highest frequency integrated). A cutoff_gap or
truncation that is not small means the integral was cut off early,
which happens when the target has a point mass or a very slowly
decaying characteristic function. The bounds do not hold then.
Details
If upper is at most \(\varepsilon\), every quantile of the target's
projection at probability \(q\) lies between the mixture's quantiles at
probabilities \(q - \varepsilon\) and \(q + \varepsilon\).
distance is the largest difference at n_grid points, spaced equally
in mixture probability between the two values in probs. It is a lower
bound.
upper is an upper bound, valid when the characteristic function of the
projected target is integrable and truncation and cutoff_gap are
small. At a point between two grid
points, the difference exceeds the larger end value by at most the
probability step, and exceeds the nearer end value by at most half the
spacing times a bound on the largest density difference. Outside the grid it adds the tail
probability probs[1] or 1 - probs[2] to the difference at the nearest
end. Move probs towards 0 and 1 to shrink the outside term.
Both bounds are computed from the numerically integrated differences, so
they hold up to the error of that integration, which neither includes.
Against closed-form distribution functions (Cauchy, normal, and a Gamma
plus uniform sum, by quadrature) that error was below 5e-6, and
distance exceeded the exact Kolmogorov distance by at most 3e-6.
References
Gil-Pelaez, J. (1951). Note on the inversion theorem. Biometrika, 38(3–4), 481–482. doi:10.1093/biomet/38.3-4.481
See also
from_cf(), from_cf_elliptical(), from_cf_sources(),
gmm_cf().
Other diagnostics:
bic_aic(),
ess_summary(),
ess_trace(),
gmm_anneal_path(),
gmm_conditional_entropy(),
gmm_entropy(),
gmm_evidence(),
gmm_fit_ensemble(),
gmm_fit_quality(),
gmm_independence_graph(),
gmm_mutual_information(),
hellinger_mc(),
kld_trace(),
proxy_functional_ci()