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

Speed 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 April 3, 2025, 5:31 p.m.