l2dpar function

L2L^2 inner product of Gaussian densities given their parameters

L2L^2 inner product of Gaussian densities given their parameters

L2L^2 inner product of multivariate (p>1p > 1) or univariate (p=1p = 1) Gaussian densities, given their parameters (mean vectors and covariance matrices if the densities are multivariate, or means and variances if univariate).

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

Arguments

  • mean1: pp-length numeric vector: the mean of the first Gaussian density.
  • var1: pp x pp symmetric numeric matrix (pp > 1) or numeric (pp = 1): the covariance matrix (pp > 1) or the variance (pp = 1) of the first Gaussian density.
  • mean2: pp-length numeric vector: the mean of the second Gaussian density.
  • var2: pp x pp symmetric numeric matrix (pp > 1) or numeric (pp = 1): the covariance matrix (pp > 1) or the variance (pp = 1) of the second Gaussian density.
  • check: logical. When TRUE (the default is FALSE) the function checks if the covariance matrices are not degenerate (multivariate case) or if the variances are not zero (univariate case).

Details

Computes the inner product of two Gaussian densities, equal to:

(2π)p/2det(var1+var2)1/2exp((1/2)t(mean1mean2)(var1+var2)1(mean1mean2)) (2\pi)^{-p/2} det(var1 + var2)^{-1/2} exp(-(1/2) t(mean1 - mean2) (var1 + var2)^{-1} (mean1 - mean2))

If p=1p = 1 the means and variances are numbers, the formula is the same ignoring the following operators: t (transpose of a matrix or vector) and det (determinant of a square matrix).

Returns

The L2L^2 inner product 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.

References

M. Wand and M. Jones (1995). Kernel Smoothing. Chapman and Hall, London.

Author(s)

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

See Also

l2d for parametrically estimated Gaussian densities or nonparametrically estimated densities, given 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) l2dpar(m1,v1,m2,v2)
  • Maintainer: Pierre Santagostini
  • License: GPL (>= 2)
  • Last published: 2024-11-22