Learn R Programming

nima (version 0.3.0)

rmvn: Simulate Multivariate Normal

Description

Simulate random variables from a multivariate normal distribution.

Usage

rmvn(n, mu = 0, sigma = matrix(1))

Arguments

n

Number of simulation replicates.

mu

Mean vector.

sigma

Variance-covariance matrix.

Value

Matrix of size n by length(mu), each row corresponding to a replicate.

Details

Use Cholesky decomposition of sigma, from chol.

See Also

rnorm

Examples

Run this code
# NOT RUN {
x <- rmvn(100, c(1,2), matrix(c(1,1,1,4), ncol = 2))

# }

Run the code above in your browser using DataLab