genr8: Simplify the the generation from a Multivariate Normal...

View source: R/genr8.R

genr8R Documentation

Simplify the the generation from a Multivariate Normal Distributions

Description

Speeds up the use of MASS::mvrnorm

Usage

genr8(n = 1, R = diag(10), mean = rep(0, ncol(R)), ...)

Arguments

n

the number of samples required.

R

a positive-definite symmetric matrix specifying the covariance matrix of the variables.

mean

an optinal vector giving the means of the variables. Default is 0.

...

Arguments for MASS::mvrnorm(), such as tol, empirical, and EISPACK.

Value

A data frame of size n by ncol(R).

Examples

set.seed(19)
R <- caron2016$mat1
mydata <- genr8(n = nrow(R)+1, R = R, empirical = TRUE)
round(mydata, 2)
round(cov(mydata), 2)

Rnest documentation built on May 29, 2024, 2:25 a.m.