rmvnorm | R Documentation |
\bold{\mu}
and covariance matrix \Sigma_{d \times d}
.Using the well-recognized Cholesky decomposition, this function simulates from the density function of a d
-dimensional random vector \bold{Y}=(Y_1,\cdots,Y_d)^{T}
following a normal distribution with mean vector \bold{\mu}
and covariance matrix \Sigma_{d \times d}
is
f_{\bold{Y}}(\bold{y})=\frac{1}{(2 \pi)^{\frac{d}{2}}\vert \Sigma\vert ^{-\frac{1}{2} } } \exp\biggl\{-\frac{(\bold{y}-\bold{\mu})^t\Sigma^{-1}(\bold{y}-\bold{\mu})}{2}\bigg\},
rmvnorm(n, Mu, Sigma)
n |
number of realizations. |
Mu |
location vector. |
Sigma |
covariance (dispersion) matrix. |
an n \times d
matrix of realizations from multivariate normal distribution with mean vector \bold{\mu}
and covariance matrix \Sigma_{d \times d}
.
Mahdi Teimouri
n <- 100
Mu <- rep(0, 2)
Sigma <- matrix( c( 2, 0.50, 0.50, 2 ), nrow = 2, ncol = 2 )
rmvnorm(n, Mu, Sigma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.