Title: | Multivariate Generalised Gaussian Distribution; Kullback-Leibler Divergence |
---|---|
Description: | Distance between multivariate generalised Gaussian distributions, as presented by N. Bouhlel and A. Dziri (2019) <doi:10.1109/LSP.2019.2915000>. Manipulation of multivariate generalised Gaussian distributions (methods presented by Gomez, Gomez-Villegas and Marin (1998) <doi:10.1080/03610929808832115> and Pascal, Bombrun, Tourneret and Berthoumieu (2013) <doi:10.1109/TSP.2013.2282909>). |
Authors: | Pierre Santagostini [aut, cre], Nizar Bouhlel [aut] |
Maintainer: | Pierre Santagostini <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.3.1 |
Built: | 2024-11-03 03:34:52 UTC |
Source: | https://github.com/cran/mggd |
This package provides tools for multivariate generalized Gaussian distributions (MGGD):
Calculation of distances/divergences between multivariate generalized Gaussian distributions:
Kullback-Leibler divergence: kldggd
Tools for MGGD:
Probability density: dmggd
Estimation of the parameters: estparmggd
Simulation from a MGGD: rmggd
Plot of the density of a MGGD with 2 variables: plotmggd
, contourmggd
Pierre Santagostini [email protected], Nizar Bouhlel [email protected]
N. Bouhlel, A. Dziri, Kullback-Leibler Divergence Between Multivariate Generalized Gaussian Distributions. IEEE Signal Processing Letters, vol. 26 no. 7, July 2019. doi:10.1109/LSP.2019.2915000
E. Gomez, M. Gomez-Villegas, H. Marin. A Multivariate Generalization of the Power Exponential Family of Distribution. Commun. Statist. 1998, Theory Methods, col. 27, no. 23, p 589-600. doi:10.1080/03610929808832115
F. Pascal, L. Bombrun, J.Y. Tourneret, Y. Berthoumieu. Parameter Estimation For Multivariate Generalized Gaussian Distribution. IEEE Trans. Signal Processing, vol. 61 no. 23, p. 5960-5971, Dec. 2013. doi:10.1109/TSP.2013.2282909 #' @keywords internal
Useful links:
Report bugs at https://forgemia.inra.fr/imhorphen/mggd/-/issues
Draws the contour plot of the probability density of the generalised Gaussian distribution with 2 variables
with mean vector mu
, dispersion matrix Sigma
and shape parameter beta
.
contourmggd(mu, Sigma, beta, xlim = c(mu[1] + c(-10, 10)*Sigma[1, 1]), ylim = c(mu[2] + c(-10, 10)*Sigma[2, 2]), zlim = NULL, npt = 30, nx = npt, ny = npt, main = "Multivariate generalised Gaussian density", sub = NULL, nlevels = 10, levels = pretty(zlim, nlevels), tol = 1e-6, ...)
contourmggd(mu, Sigma, beta, xlim = c(mu[1] + c(-10, 10)*Sigma[1, 1]), ylim = c(mu[2] + c(-10, 10)*Sigma[2, 2]), zlim = NULL, npt = 30, nx = npt, ny = npt, main = "Multivariate generalised Gaussian density", sub = NULL, nlevels = 10, levels = pretty(zlim, nlevels), tol = 1e-6, ...)
mu |
length 2 numeric vector. |
Sigma |
symmetric, positive-definite square matrix of order 2. The dispersion matrix. |
beta |
positive real number. The shape of the first distribution. |
xlim , ylim
|
x-and y- limits. |
zlim |
z- limits. If NULL, it is the range of the values of the density on the x and y values within |
npt |
number of points for the discretisation. |
nx , ny
|
number of points for the discretisation among the x- and y- axes. |
main , sub
|
main and sub title, as for |
nlevels , levels
|
arguments to be passed to the |
tol |
tolerance (relative to largest variance) for numerical lack of positive-definiteness in Sigma, for the estimation of the density. see |
... |
additional arguments to |
Returns invisibly the probability density function.
Pierre Santagostini, Nizar Bouhlel
E. Gomez, M. Gomez-Villegas, H. Marin. A Multivariate Generalization of the Power Exponential Family of Distribution. Commun. Statist. 1998, Theory Methods, col. 27, no. 23, p 589-600. doi:10.1080/03610929808832115
plotmggd
: plot of a bivariate generalised Gaussian density.
dmggd
: Probability density of a multivariate generalised Gaussian distribution.
mu <- c(1, 4) Sigma <- matrix(c(0.8, 0.2, 0.2, 0.2), nrow = 2) beta <- 0.74 contourmggd(mu, Sigma, beta)
mu <- c(1, 4) Sigma <- matrix(c(0.8, 0.2, 0.2, 0.2), nrow = 2) beta <- 0.74 contourmggd(mu, Sigma, beta)
Density of the multivariate ( variables) generalized Gaussian distribution (MGGD)
with mean vector
mu
, dispersion matrix Sigma
and shape parameter beta
.
dmggd(x, mu, Sigma, beta, tol = 1e-6)
dmggd(x, mu, Sigma, beta, tol = 1e-6)
x |
length |
mu |
length |
Sigma |
symmetric, positive-definite square matrix of order |
beta |
positive real number. The shape of the distribution. |
tol |
tolerance (relative to largest variance) for numerical lack of positive-definiteness in Sigma. |
The density function of a multivariate generalized Gaussian distribution is given by:
When (univariate case) it becomes:
The value of the density.
Pierre Santagostini, Nizar Bouhlel
E. Gomez, M. Gomez-Villegas, H. Marin. A Multivariate Generalization of the Power Exponential Family of Distribution. Commun. Statist. 1998, Theory Methods, col. 27, no. 23, p 589-600. doi:10.1080/03610929808832115
rmggd
: random generation from a MGGD.
estparmggd
: estimation of the parameters of a MGGD.
plotmggd
, contourmggd
: plot of the probability density of a bivariate generalised Gaussian distribution.
mu <- c(0, 1, 4) Sigma <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) beta <- 0.74 dmggd(c(0, 1, 4), mu, Sigma, beta) dmggd(c(1, 2, 3), mu, Sigma, beta)
mu <- c(0, 1, 4) Sigma <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) beta <- 0.74 dmggd(c(0, 1, 4), mu, Sigma, beta) dmggd(c(1, 2, 3), mu, Sigma, beta)
Estimation of the mean vector, dispersion matrix and shape parameter of a multivariate generalized Gaussian distribution (MGGD).
estparmggd(x, eps = 1e-6, display = FALSE, plot = display)
estparmggd(x, eps = 1e-6, display = FALSE, plot = display)
x |
numeric matrix or data frame. |
eps |
numeric. Precision for the estimation of the beta parameter. |
display |
logical. When |
plot |
logical. When |
The parameter is the mean vector of
x
.
The dispersion matrix and shape parameter:
are computed
using the method presented in Pascal et al., using an iterative algorithm.
The precision for the estimation of beta
is given by the eps
parameter.
A list of 3 elements:
mu
the mean vector.
Sigma
: symmetric positive-definite matrix. The dispersion matrix.
beta
non-negative numeric value. The shape parameter.
with two attributes attr(, "epsilon")
(precision of the result) and attr(, "k")
(number of iterations).
Pierre Santagostini, Nizar Bouhlel
F. Pascal, L. Bombrun, J.Y. Tourneret, Y. Berthoumieu. Parameter Estimation For Multivariate Generalized Gaussian Distribution. IEEE Trans. Signal Processing, vol. 61 no. 23, p. 5960-5971, Dec. 2013. doi: 10.1109/TSP.2013.2282909
dmggd
: probability density of a MGGD.
rmggd
: random generation from a MGGD.
mu <- c(0, 1, 4) Sigma <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) beta <- 0.74 x <- rmggd(100, mu, Sigma, beta) # Estimation of the parameters estparmggd(x)
mu <- c(0, 1, 4) Sigma <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) beta <- 0.74 x <- rmggd(100, mu, Sigma, beta) # Estimation of the parameters estparmggd(x)
Computes the Kullback- Leibler divergence between two random variables distributed according to multivariate generalized Gaussian distributions (MGGD) with zero means.
kldggd(Sigma1, beta1, Sigma2, beta2, eps = 1e-06)
kldggd(Sigma1, beta1, Sigma2, beta2, eps = 1e-06)
Sigma1 |
symmetric, positive-definite matrix. The dispersion matrix of the first distribution. |
beta1 |
positive real number. The shape parameter of the first distribution. |
Sigma2 |
symmetric, positive-definite matrix. The dispersion matrix of the second distribution. |
beta2 |
positive real number. The shape parameter of the second distribution. |
eps |
numeric. Precision for the computation of the Lauricella function
(see |
Given , a random vector of
(
) distributed according to the MGGD
with parameters
and
, a random vector of
distributed according to the MGGD
with parameters
.
The Kullback-Leibler divergence between and
is given by:
where are the eigenvalues
of the matrix
and is the Lauricella
-hypergeometric Function.
This computation uses the lauricella
function.
When (univariate case):
let
, a random variable distributed according to the generalized Gaussian distribution
with parameters
and
, a random variable distributed according to the generalized Gaussian distribution
with parameters
.
A numeric value: the Kullback-Leibler divergence between the two distributions,
with two attributes attr(, "epsilon")
(precision of the result of the Lauricella function;
0 if the distributions are univariate)
and attr(, "k")
(number of iterations).
Pierre Santagostini, Nizar Bouhlel
N. Bouhlel, A. Dziri, Kullback-Leibler Divergence Between Multivariate Generalized Gaussian Distributions. IEEE Signal Processing Letters, vol. 26 no. 7, July 2019. doi:10.1109/LSP.2019.2915000
dmggd: probability density of a MGGD.
beta1 <- 0.74 beta2 <- 0.55 Sigma1 <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) Sigma2 <- matrix(c(1, 0.3, 0.2, 0.3, 0.5, 0.1, 0.2, 0.1, 0.7), nrow = 3) # Kullback-Leibler divergence kl12 <- kldggd(Sigma1, beta1, Sigma2, beta2) kl21 <- kldggd(Sigma2, beta2, Sigma1, beta1) print(kl12) print(kl21) # Distance (symmetrized Kullback-Leibler divergence) kldist <- as.numeric(kl12) + as.numeric(kl21) print(kldist)
beta1 <- 0.74 beta2 <- 0.55 Sigma1 <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) Sigma2 <- matrix(c(1, 0.3, 0.2, 0.3, 0.5, 0.1, 0.2, 0.1, 0.7), nrow = 3) # Kullback-Leibler divergence kl12 <- kldggd(Sigma1, beta1, Sigma2, beta2) kl21 <- kldggd(Sigma2, beta2, Sigma1, beta1) print(kl12) print(kl21) # Distance (symmetrized Kullback-Leibler divergence) kldist <- as.numeric(kl12) + as.numeric(kl21) print(kldist)
-Hypergeometric FunctionComputes the Lauricella -hypergeometric Function function.
lauricella(a, b, g, x, eps = 1e-06)
lauricella(a, b, g, x, eps = 1e-06)
a |
numeric. |
b |
numeric vector. |
g |
numeric. |
x |
numeric vector. |
eps |
numeric. Precision for the nested sums (default 1e-06). |
If is the length of the
and
x
vectors,
the Lauricella -hypergeometric Function function is given by:
where is the Pochhammer symbol (see
pochhammer
).
If , this sum converges.
Otherwise there is an error.
The eps
argument gives the required precision for its computation.
It is the attr(, "epsilon")
attribute of the returned value.
Sometimes, the convergence is too slow and the required precision cannot be reached.
If this happens, the attr(, "epsilon")
attribute is the precision that was really reached.
A numeric value: the value of the Lauricella function,
with two attributes attr(, "epsilon")
(precision of the result) and attr(, "k")
(number of iterations).
Pierre Santagostini, Nizar Bouhlel
N. Bouhlel, A. Dziri, Kullback-Leibler Divergence Between Multivariate Generalized Gaussian Distributions. IEEE Signal Processing Letters, vol. 26 no. 7, July 2019. doi:10.1109/LSP.2019.2915000
Computes the logarithm of the Pochhammer symbol.
lnpochhammer(x, n)
lnpochhammer(x, n)
x |
numeric. |
n |
positive integer. |
The Pochhammer symbol is given by:
So, if :
If ,
Numeric value. The logarithm of the Pochhammer symbol.
Pierre Santagostini, Nizar Bouhlel
lnpochhammer(2, 0) lnpochhammer(2, 1) lnpochhammer(2, 3)
lnpochhammer(2, 0) lnpochhammer(2, 1) lnpochhammer(2, 3)
Plots the probability density of the generalised Gaussian distribution with 2 variables
with mean vector mu
, dispersion matrix Sigma
and shape parameter beta
.
plotmggd(mu, Sigma, beta, xlim = c(mu[1] + c(-10, 10)*Sigma[1, 1]), ylim = c(mu[2] + c(-10, 10)*Sigma[2, 2]), n = 101, xvals = NULL, yvals = NULL, xlab = "x", ylab = "y", zlab = "f(x,y)", col = "gray", tol = 1e-6, ...)
plotmggd(mu, Sigma, beta, xlim = c(mu[1] + c(-10, 10)*Sigma[1, 1]), ylim = c(mu[2] + c(-10, 10)*Sigma[2, 2]), n = 101, xvals = NULL, yvals = NULL, xlab = "x", ylab = "y", zlab = "f(x,y)", col = "gray", tol = 1e-6, ...)
mu |
length 2 numeric vector. |
Sigma |
symmetric, positive-definite square matrix of order 2. The dispersion matrix. |
beta |
positive real number. The shape of the distribution. |
xlim , ylim
|
x-and y- limits. |
n |
A one or two element vector giving the number of steps in the x and y grid, passed to |
xvals , yvals
|
The values at which to evaluate |
xlab , ylab , zlab
|
The axis labels. |
col |
The color to use for the plot. See |
tol |
tolerance (relative to largest variance) for numerical lack of positive-definiteness in Sigma, for the estimation of the density. see |
... |
Additional arguments to pass to |
Returns invisibly the probability density function.
Pierre Santagostini, Nizar Bouhlel
E. Gomez, M. Gomez-Villegas, H. Marin. A Multivariate Generalization of the Power Exponential Family of Distribution. Commun. Statist. 1998, Theory Methods, col. 27, no. 23, p 589-600. doi:10.1080/03610929808832115
contourmggd
: contour plot of a bivariate generalised Gaussian density.
dmggd
: Probability density of a multivariate generalised Gaussian distribution.
mu <- c(1, 4) Sigma <- matrix(c(0.8, 0.2, 0.2, 0.2), nrow = 2) beta <- 0.74 plotmggd(mu, Sigma, beta)
mu <- c(1, 4) Sigma <- matrix(c(0.8, 0.2, 0.2, 0.2), nrow = 2) beta <- 0.74 plotmggd(mu, Sigma, beta)
Computes the Pochhammer symbol.
pochhammer(x, n)
pochhammer(x, n)
x |
numeric. |
n |
positive integer. |
The Pochhammer symbol is given by:
Numeric value. The value of the Pochhammer symbol.
Pierre Santagostini, Nizar Bouhlel
pochhammer(2, 0) pochhammer(2, 1) pochhammer(2, 3)
pochhammer(2, 0) pochhammer(2, 1) pochhammer(2, 3)
Produces one or more samples from a multivariate ( variables) generalized Gaussian distribution (MGGD).
rmggd(n = 1 , mu, Sigma, beta, tol = 1e-6)
rmggd(n = 1 , mu, Sigma, beta, tol = 1e-6)
n |
integer. Number of observations. |
mu |
length |
Sigma |
symmetric, positive-definite square matrix of order |
beta |
positive real number. The shape of the distribution. |
tol |
tolerance (relative to largest variance) for numerical lack of positive-definiteness in Sigma. |
A sample from a centered MGGD with dispersion matrix
and shape parameter
can be generated using:
where is a random vector uniformly distributed on the unit sphere and
is such that
is generated from a distribution Gamma
with shape parameter
and scale parameter
.
This property is used to generate a sample from a MGGD.
A matrix with columns and
n
rows.
Pierre Santagostini, Nizar Bouhlel
E. Gomez, M. Gomez-Villegas, H. Marin. A Multivariate Generalization of the Power Exponential Family of Distribution. Commun. Statist. 1998, Theory Methods, col. 27, no. 23, p 589-600. doi:10.1080/03610929808832115
dmggd
: probability density of a MGGD..
estparmggd
: estimation of the parameters of a MGGD.
mu <- c(0, 0, 0) Sigma <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) beta <- 0.74 rmggd(100, mu, Sigma, beta)
mu <- c(0, 0, 0) Sigma <- matrix(c(0.8, 0.3, 0.2, 0.3, 0.2, 0.1, 0.2, 0.1, 0.2), nrow = 3) beta <- 0.74 rmggd(100, mu, Sigma, beta)