### 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.