Nothing
# TODO: Add comment
#
# Author: Vahid Nassiri
###############################################################################
#' generates random numbers from multivariate normal
#' @param n
#' @param mu
#' @param sigmaMat
#' @return
#'
#' @author Vahid Nassiri
#' @noRd
genMVN <- function(n, mu, sigmaMat){
## obtain number of variables
numVar <- length(mu)
## generate independent data
indData <- matrix(rnorm(n*numVar),n , numVar)
## find the Cholesky decomposition of the covariance matrix
choleskyDecompSigma <- chol(sigmaMat)
## make the indepedent data dependent
genData <- (indData%*% choleskyDecompSigma) + mu[col(indData%*% choleskyDecompSigma)]
return(genData)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.