These functions provide the density function and a random number
generator for the multivariate normal
distribution with mean equal to `mean`

and covariance matrix
`sigma`

.

```
dmvnorm(x, mean = rep(0, p), sigma = diag(p), log = FALSE, checkSymmetry = TRUE)
rmvnorm(n, mean = rep(0, nrow(sigma)), sigma = diag(length(mean)),
method=c("eigen", "svd", "chol"), pre0.9_9994 = FALSE, checkSymmetry = TRUE)
```

x

vector or matrix of quantiles. If `x`

is a matrix, each
row is taken to be a quantile.

n

number of observations.

mean

mean vector, default is `rep(0, length = ncol(x))`

.

sigma

covariance matrix, default is `diag(ncol(x))`

.

log

logical; if `TRUE`

, densities d are given as log(d).

method

string specifying the matrix decomposition used to
determine the matrix root of `sigma`

. Possible methods are
eigenvalue decomposition (`"eigen"`

, default),
singular value decomposition (`"svd"`

), and
Cholesky decomposition (`"chol"`

). The
Cholesky is typically fastest, not by much though.

pre0.9_9994

logical; if `FALSE`

, the output produced in mvtnorm
versions up to 0.9-9993 is reproduced. In 0.9-9994, the
output is organized such that `rmvnorm(10,...)`

has the
same first ten rows as `rmvnorm(100, ...)`

when called
with the same seed.

checkSymmetry

logical; if `FALSE`

, skip checking whether the
covariance matrix is symmetric or not. This will speed up the
computation but may cause unexpected outputs when ill-behaved
`sigma`

is provided. The default value is `TRUE`

.

# NOT RUN { dmvnorm(x=c(0,0)) dmvnorm(x=c(0,0), mean=c(1,1)) sigma <- matrix(c(4,2,2,3), ncol=2) x <- rmvnorm(n=500, mean=c(1,2), sigma=sigma) colMeans(x) var(x) x <- rmvnorm(n=500, mean=c(1,2), sigma=sigma, method="chol") colMeans(x) var(x) plot(x) # }