Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


amen (version 1.0)

rmvnorm: Simulation from a multivariate normal distribution

Description

Simulates a matrix where the rows are i.i.d. samples from a multivariate normal distribution

Usage

rmvnorm(n, mu, Sigma, Sigma.chol = chol(Sigma))

Arguments

n
sample size
mu
multivariate mean vector
Sigma
covariance matrix
Sigma.chol
Cholesky factorization of Sigma

Value

  • a matrix with n rows

Examples

Run this code
## The function is currently defined as
function (n, mu, Sigma, Sigma.chol = chol(Sigma))
{
    E <- matrix(rnorm(n * length(mu)), n, length(mu))
    t(t(E %*% Sigma.chol) + c(mu))
  }

Run the code above in your browser using DataLab