CSgenerate: Generate a compound symmetric correlation matrix

Description Usage Arguments Value Examples

View source: R/matrixutils.R

Description

Generate a compound symmetric correlation matrix

Usage

1
CSgenerate(n, rho)

Arguments

n

number of dimensions

rho

off-diagonal element - a correlation between -1 and 1. Will warn if less than 0.

Value

returns an n * n matrix with 1 on the diagonal and rho on the off-diagonal.

Examples

1
2
3
# generates a covariance matrix with 1 on the main diagonal
# and 0.5 on the off-diagonal elements.
CSgenerate(3, .5)

gzt/MixMatrix documentation built on Nov. 18, 2021, 11:02 a.m.