Create correlation matrices.
lazyCor.RdUse can supply either a single value (the common correlation among all variables), a column of the lower triangular values for a correlation matrix, or a candidate matrix. The function will check X and do the right thing. If X is a matrix, check that it is a valid correlation matrix. If its a single value, use that to fill up a matrix. If itis a vector, try to use it as a vech to fill the lower triangle..
Author
Paul Johnson pauljohn@ku.edu
Examples
lazyCor(0.5, 8)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
#> [1,] 1.0 0.5 0.5 0.5 0.5 0.5 0.5 0.5
#> [2,] 0.5 1.0 0.5 0.5 0.5 0.5 0.5 0.5
#> [3,] 0.5 0.5 1.0 0.5 0.5 0.5 0.5 0.5
#> [4,] 0.5 0.5 0.5 1.0 0.5 0.5 0.5 0.5
#> [5,] 0.5 0.5 0.5 0.5 1.0 0.5 0.5 0.5
#> [6,] 0.5 0.5 0.5 0.5 0.5 1.0 0.5 0.5
#> [7,] 0.5 0.5 0.5 0.5 0.5 0.5 1.0 0.5
#> [8,] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1.0
lazyCor(c(0.1, 0.2, 0.3))
#> [,1] [,2] [,3]
#> [1,] 1.0 0.1 0.2
#> [2,] 0.1 1.0 0.3
#> [3,] 0.2 0.3 1.0
lazyCor(c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6))
#> [,1] [,2] [,3] [,4]
#> [1,] 1.0 0.1 0.2 0.3
#> [2,] 0.1 1.0 0.4 0.5
#> [3,] 0.2 0.4 1.0 0.6
#> [4,] 0.3 0.5 0.6 1.0