createSigma: createSigma: convenience function for mvrnorm

Description Usage Arguments Value Author(s) See Also Examples

View source: R/createSigma.R

Description

This function is made to quickly generate a Sigma matrix of the type required by mvrnorm. By specifying the number of variables, the mean correlation, and how much variation there should be in the correlations, it's easy to quickly generate a correlation matrix.

Usage

1
createSigma(nVar, meanR = 0.3, sdR = 0, diagonal = 1)

Arguments

nVar

The number of variables in the correlation matrix.

meanR

The average correlation, provided to rnorm together with sdR to generate the correlations.

sdR

The variation in the correlations, provided to rnorm together with meanR to generate the correlations.

diagonal

The value on the diagonal of the returned matrix: will normally be 1.

Value

A matrix of nVar x nVar.

Author(s)

Gjalt-Jorn Peters

Maintainer: Gjalt-Jorn Peters <gjalt-jorn@userfriendlyscience.com>

See Also

mvrnorm, rnorm, matrix

Examples

1
createSigma(3, .5, .1);

userfriendlyscience documentation built on May 2, 2019, 1:09 p.m.