Learn R Programming

broman (version 0.59-5)

rmvn: Simulate multivariate normal

Description

Simulate from a multivariate normal distribution.

Usage

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

Arguments

n
Number of simulation replicates.
mu
Mean vector.
V
Variance-covariance matrix.

Value

  • A matrix of size n x length(mu). Each row corresponds to a separate replicate.

Details

Uses the Cholesky decomposition of the matrix V, obtained by chol.

See Also

rnorm

Examples

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

Run the code above in your browser using DataLab