R/dqrmv.R

Defines functions dqrmvnorm

Documented in dqrmvnorm

#' @title Multivariate Distributions
#'
#' @param n  number of  observations
#' @param ... forwarded to \code{\link[mvtnorm]{rmvnorm}} or \code{\link[mvtnorm]{rmvt}}
#'
#' @return numeric matrix of multivariate normal distributed variables
#' @seealso \code{\link[mvtnorm]{rmvnorm}}
#'
#' @export
#'
#' @rdname dqrmv
#' @examples
#' sigma <- matrix(c(4,2,2,3), ncol=2)
#' x <- dqrmvnorm(n=500, mean=c(1,2), sigma=sigma)
#' colMeans(x)
#' var(x)
#' plot(x)
dqrmvnorm <- function(n, ...) {
  if (!requireNamespace("mvtnorm", quietly = TRUE)) {
    stop(
      "Package \"mvtnorm\" must be installed to use this function.",
      call. = FALSE
    )
  }
  mvtnorm::rmvnorm(n, ..., rnorm = dqrnorm)
}

Try the dqrng package in your browser

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

dqrng documentation built on Aug. 31, 2023, 1:07 a.m.