## File: The-Multivariate-Gaussian-Distribution.html

package info (click to toggle)
gsl-ref-html 2.3-1
• area: non-free
• in suites: bullseye, buster, sid
• size: 6,876 kB
• ctags: 4,574
• sloc: makefile: 35
 file content (136 lines) | stat: -rw-r--r-- 8,379 bytes parent folder | download
 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136  GNU Scientific Library – Reference Manual: The Multivariate Gaussian Distribution

20.5 The Multivariate Gaussian Distribution

Function: int gsl_ran_multivariate_gaussian (const gsl_rng * r, const gsl_vector * mu, const gsl_matrix * L, gsl_vector * result)

This function generates a random vector satisfying the k-dimensional multivariate Gaussian distribution with mean \mu and variance-covariance matrix \Sigma. On input, the k-vector \mu is given in mu, and the Cholesky factor of the k-by-k matrix \Sigma = L L^T is given in the lower triangle of L, as output from gsl_linalg_cholesky_decomp. The random vector is stored in result on output. The probability distribution for multivariate Gaussian random variates is

p(x_1,...,x_k) dx_1 ... dx_k = {1 \over \sqrt{(2 \pi)^k |\Sigma|} \exp \left(-{1 \over 2} (x - \mu)^T \Sigma^{-1} (x - \mu)\right) dx_1 \dots dx_k
Function: int gsl_ran_multivariate_gaussian_pdf (const gsl_vector * x, const gsl_vector * mu, const gsl_matrix * L, double * result, gsl_vector * work)
Function: int gsl_ran_multivariate_gaussian_log_pdf (const gsl_vector * x, const gsl_vector * mu, const gsl_matrix * L, double * result, gsl_vector * work)

These functions compute p(x) or \log{p(x)} at the point x, using mean vector mu and variance-covariance matrix specified by its Cholesky factor L using the formula above. Additional workspace of length k is required in work.

Function: int gsl_ran_multivariate_gaussian_mean (const gsl_matrix * X, gsl_vector * mu_hat)

Given a set of n samples X_j from a k-dimensional multivariate Gaussian distribution, this function computes the maximum likelihood estimate of the mean of the distribution, given by

\Hat{\mu} = {1 \over n} \sum_{j=1}^n X_j

The samples X_1,X_2,\dots,X_n are given in the n-by-k matrix X, and the maximum likelihood estimate of the mean is stored in mu_hat on output.

Function: int gsl_ran_multivariate_gaussian_vcov (const gsl_matrix * X, gsl_matrix * sigma_hat)

Given a set of n samples X_j from a k-dimensional multivariate Gaussian distribution, this function computes the maximum likelihood estimate of the variance-covariance matrix of the distribution, given by

\Hat{\Sigma} = {1 \over n} \sum_{j=1}^n \left( X_j - \Hat{\mu} \right) \left( X_j - \Hat{\mu} \right)^T

The samples X_1,X_2,\dots,X_n are given in the n-by-k matrix X and the maximum likelihood estimate of the variance-covariance matrix is stored in sigma_hat on output.