R/SRM_MVRNORM.R

Defines functions SRM_MVRNORM

## File Name: SRM_MVRNORM.R
## File Version: 0.03

SRM_MVRNORM <- function(n, mu, Sigma)
{
    svd1 <- svd(Sigma)
    L <- svd1$u %*% diag(sqrt(svd1$d))
    ny <- ncol(Sigma)
    r <- matrix( stats::rnorm(n*ny), nrow=n, ncol=ny)
    muM <- matrix(mu, nrow=n, ncol=ny, byrow=TRUE)
    y <- muM + tcrossprod(r, L)
    return(y)
}

Try the srm package in your browser

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

srm documentation built on Nov. 3, 2022, 5:06 p.m.