R/rmvnorm.R

Defines functions rmvnorm

Documented in rmvnorm

rmvnorm <- function(n, Mu, Sigma)
{
  Dim <- length( Mu )
    Y <- matrix(NA, nrow = n, ncol = Dim)
    L <- t( chol( Sigma ) )
      for(i in 1:n)
      {
        Y[i, ] <- L %*% rnorm( Dim ) + Mu
      }
    return( Y )
}

Try the mixbox package in your browser

Any scripts or data that you put into this service are public.

mixbox documentation built on May 29, 2024, 3:58 a.m.