wassersteinpar {dad} | R Documentation |
2-Wasserstein distance between Gaussian densities given their parameters
Description
The 2-Wasserstein distance between two multivariate (p > 1
) or univariate (p = 1
) Gaussian densities given their parameters (mean vectors and covariance matrices if the densities are multivariate, or means and variances if univariate) (see Details).
Usage
wassersteinpar(mean1, var1, mean2, var2, check = FALSE)
Arguments
mean1 |
|
var1 |
|
mean2 |
|
var2 |
|
check |
logical. When |
Details
The mean vectors (m1
and m2
) and variance matrices (v1
and v2
) given as arguments (mean1
, mean2
, var1
and var2
) are used to compute the 2-Wasserstein distance between the two Gaussian densities, equal to:
(||m1-m2||_2^2 + trace((v1+v2) - 2*(v2^{1/2} v1 v2^{1/2})^{1/2}))^{1/2}
If p = 1
:
((m1-m2)^2 + v1 + v2 - 2*(v1*v2)^{1/2})^{1/2}
Value
The 2-Wasserstein distance between two Gaussian densities.
Be careful! If check = FALSE
and one covariance matrix is degenerated (multivariate case) or one variance is zero (univariate case), the result returned must not be considered.
Author(s)
Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard
References
Peterson, A., Mueller, H.G (2016). Functional Data Analysis for Density Functions by Transformation to a Hilbert Space. The annals of Statistics, 44 (1), 183-218. DOI: 10.1214/15-AOS1363
Dowson, D.C., Ladau, B.V. (1982). The Fréchet Distance between Multivariate Normal Distributions. Journal of Multivariate Analysis, 12, 450-455.
See Also
wasserstein: 2-Wasserstein distance between Gaussian densities estimated from samples.
Examples
m1 <- c(1,1)
v1 <- matrix(c(4,1,1,9),ncol = 2)
m2 <- c(0,1)
v2 <- matrix(c(1,0,0,1),ncol = 2)
wassersteinpar(m1,v1,m2,v2)