distl2dpar: L^2 distance between Gaussian densities given their...

View source: R/distl2dpar.R

distl2dparR Documentation

L^2 distance between Gaussian densities given their parameters


L^2 distance between two multivariate (p > 1) or univariate (dimension: p = 1) Gaussian densities, given their parameters (mean vectors and covariance matrices if the densities are multivariate, or means and variances if univariate).


distl2dpar(mean1, var1, mean2, var2, check = FALSE)


mean1, mean2

means of the probability densities.

var1, var2

variances (p = 1) or covariance matrices (p > 1) of the probability densities.


logical. When TRUE (the default is FALSE) the function checks if the covariance matrices are not degenerate, before computing the inner product.

If the variables are univariate, it checks if the variances are not zero.


The function distl2dpar computes the distance between two densities, say f_1 and f_2, from the formula:

||f_1 - f_2||^2 = <f_1, f_1> + <f_2, f_2> - 2 <f_1, f_2>


For some information about the method used to compute the L^2 inner product or about the arguments, see l2dpar.


The L^2 distance between the two densities.

Be careful! If check = FALSE and one variance matrix is degenerated (or one variance is zero if the densities are univariate), the result returned must not be considered.


Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard

See Also

matdistl2d in order to compute pairwise distances between several densities.


u1 <- c(1,1,1);
v1 <- matrix(c(4,0,0,0,16,0,0,0,25),ncol = 3);
u2 <- c(0,1,0);
v2 <- matrix(c(1,0,0,0,1,0,0,0,1),ncol = 3);

dad documentation built on Aug. 30, 2023, 5:06 p.m.