View source: R/dist_multivariate_normal.R
| dist_multivariate_normal | R Documentation |
The multivariate normal distribution is a generalization of the univariate normal distribution to higher dimensions. It is widely used in multivariate statistics and describes the joint distribution of multiple correlated continuous random variables.
dist_multivariate_normal(mu = 0, sigma = list(diag(1)))
mu |
A list of numeric vectors for the distribution's mean. |
sigma |
A list of matrices for the distribution's variance-covariance matrix. |
We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_multivariate_normal.html
In the following, let \mathbf{X} be a k-dimensional multivariate
normal random variable with mean vector mu = \boldsymbol{\mu} and
variance-covariance matrix sigma = \boldsymbol{\Sigma}.
Support: \mathbf{x} \in \mathbb{R}^k
Mean: \boldsymbol{\mu}
Variance-covariance matrix: \boldsymbol{\Sigma}
Probability density function (p.d.f):
f(\mathbf{x}) = \frac{1}{(2\pi)^{k/2} |\boldsymbol{\Sigma}|^{1/2}}
\exp\left(-\frac{1}{2}(\mathbf{x} - \boldsymbol{\mu})^T
\boldsymbol{\Sigma}^{-1}(\mathbf{x} - \boldsymbol{\mu})\right)
where |\boldsymbol{\Sigma}| is the determinant of
\boldsymbol{\Sigma}.
Cumulative distribution function (c.d.f):
P(\mathbf{X} \le \mathbf{q}) = P(X_1 \le q_1, \ldots, X_k \le q_k)
The c.d.f. does not have a closed-form expression and is computed numerically.
Moment generating function (m.g.f):
M(\mathbf{t}) = E(e^{\mathbf{t}^T \mathbf{X}}) =
\exp\left(\mathbf{t}^T \boldsymbol{\mu} + \frac{1}{2}\mathbf{t}^T
\boldsymbol{\Sigma} \mathbf{t}\right)
mvtnorm::dmvnorm(), mvtnorm::pmvnorm(), mvtnorm::qmvnorm(),
mvtnorm::rmvnorm()
dist <- dist_multivariate_normal(mu = list(c(1,2)), sigma = list(matrix(c(4,2,2,3), ncol=2)))
dimnames(dist) <- c("x", "y")
dist
mean(dist)
variance(dist)
support(dist)
generate(dist, 10)
density(dist, cbind(2, 1))
density(dist, cbind(2, 1), log = TRUE)
cdf(dist, 4)
quantile(dist, 0.7, kind = "equicoordinate")
quantile(dist, 0.7, kind = "marginal")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.