R/Internal.R

Defines functions rmvn

Documented in rmvn

#' rmvn
#' @keywords internal
#' @param n Sample Size
#' @param sigma Covariance matrix
#' @return Generates multivariate normal data from a covariance matrix (\code{sigma}) of length \code{n}
#'
rmvn <- function(n,sigma) {
     Sh <- with(svd(sigma),
                v%*%diag(sqrt(d))%*%t(u))
     matrix(stats::rnorm(ncol(sigma)*n),
            ncol = ncol(sigma))%*%Sh
}

Try the ACEsimFit package in your browser

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

ACEsimFit documentation built on Oct. 12, 2022, 9:05 a.m.