View source: R/distributions-multivariate_normal.R
distr_multivariate_normal | R Documentation |
Creates a multivariate normal (also called Gaussian) distribution parameterized by a mean vector and a covariance matrix.
distr_multivariate_normal(
loc,
covariance_matrix = NULL,
precision_matrix = NULL,
scale_tril = NULL,
validate_args = NULL
)
loc |
(Tensor): mean of the distribution |
covariance_matrix |
(Tensor): positive-definite covariance matrix |
precision_matrix |
(Tensor): positive-definite precision matrix |
scale_tril |
(Tensor): lower-triangular factor of covariance, with positive-valued diagonal |
validate_args |
Bool wether to validate the arguments or not. |
The multivariate normal distribution can be parameterized either
in terms of a positive definite covariance matrix \mathbf{\Sigma}
or a positive definite precision matrix \mathbf{\Sigma}^{-1}
or a lower-triangular matrix \mathbf{L}
with positive-valued
diagonal entries, such that
\mathbf{\Sigma} = \mathbf{L}\mathbf{L}^\top
. This triangular matrix
can be obtained via e.g. Cholesky decomposition of the covariance.
Only one of covariance_matrix
or precision_matrix
or
scale_tril
can be specified.
Using scale_tril
will be more efficient: all computations internally
are based on scale_tril
. If covariance_matrix
or
precision_matrix
is passed instead, it is only used to compute
the corresponding lower triangular matrices using a Cholesky decomposition.
Distribution for details on the available methods.
Other distributions:
distr_bernoulli()
,
distr_chi2()
,
distr_gamma()
,
distr_normal()
,
distr_poisson()
if (torch_is_installed()) {
m <- distr_multivariate_normal(torch_zeros(2), torch_eye(2))
m$sample() # normally distributed with mean=`[0,0]` and covariance_matrix=`I`
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.