Generate a compound symmetric correlation matrix
CSgenerate(n, rho)
returns an \(n \times n\) matrix with 1 on the diagonal and
rho
on the off-diagonal.
# generates a covariance matrix with 1 on the main diagonal
# and 0.5 on the off-diagonal elements.
CSgenerate(3, .5)
#> [,1] [,2] [,3]
#> [1,] 1.0 0.5 0.5
#> [2,] 0.5 1.0 0.5
#> [3,] 0.5 0.5 1.0