rsmvnorm: Simulating Continuous Random Vectors from a Multivariate...

Description Usage Arguments Details Value Author(s) Examples

Description

Utility function to simulate continuous random vectors from a multivariate normal distribution such that all marginal distributions are univariate standard normal.

Usage

1
rsmvnorm(R, cor.matrix)

Arguments

R

integer indicating the sample size.

cor.matrix

matrix indicating the correlation matrix of the multivariate normal distribution.

Details

Checks are made to ensure that cor.matrix is a positive definite correlation matrix. The positive definiteness of cor.matrix is assessed via eigenvalues.

Value

Returns R random vectors of size ncol(cor.matrix).

Author(s)

Anestis Touloumis

Examples

1
2
3
4
5
6
7
8
9
## Simulating 10000 bivariate random vectors with correlation parameter
## equal to 0.4.
set.seed(1)
R <- 10000
cor.matrix <- toeplitz(c(1, 0.4))
SimBivariateNormal <- rsmvnorm(R = R, cor.matrix = cor.matrix)
colMeans(SimBivariateNormal)
apply(SimBivariateNormal, 2, sd)
cor(SimBivariateNormal)


Search within the SimCorMultRes package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.