cor.mat: Generate Two Type of Correlation Matrix

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/cor.mat.R

Description

Generate two type of correlation matrix

Usage

1
  cor.mat(p, rho, type='toeplitz')

Arguments

p

a positive integer, the dimension of correlation matrix.

rho

a value between 0 and 1, a baseline vlaue of correlation coefficient.

type

a character, specify the type of correlation matrix and only include 'toeplitz' and 'identity' in current version.

Details

The argument rho specify the size of correlation coeffient. As for argument type, if type='toeplitz', sigma_ij=rho^|i-j|; if type ='identity', sigma_ij=rho when i!=j and sigma_ij=1 when i=j.

Value

return a correlation matrix with a type of specified structure.

Note

nothing

Author(s)

Liu Wei

References

nothing.

See Also

cov2cor

Examples

1
2
  cor.mat(5, 0.5)
  cor.mat(5, 0.5, type='identity')

feiyoung/simutool documentation built on Sept. 15, 2021, 10:14 p.m.