R/dqrmv.R

Defines functions dqrmvnorm

Documented in dqrmvnorm

#' @title Multivariate Distributions
#'
#' @param n  number of  observations
#' @param ... forwarded to \code{\link[mvtnorm]{rmvnorm}}
#'
#' @return numeric matrix of multivariate normal distributed variables
#' @seealso \code{\link[mvtnorm]{rmvnorm}}
#'
#' @export
#'
#' @rdname dqrmv
#' @examplesIf requireNamespace("mvtnorm", quietly = TRUE)
#' 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 May 29, 2024, 12:10 p.m.