cormat makes a correlation matrix from a single number,
vars\*vars matrix, vars\*vars vector, or a vars\*(vars-1)/2 vector.
cormat(cors = 0, vars = 3)
| cors | the correlations among the variables (can be a single number, vars\*vars matrix, vars\*vars vector, or a vars\*(vars-1)/2 vector) |
|---|---|
| vars | the number of variables in the matrix |
matrix
cormat(.5, 3)#> [,1] [,2] [,3] #> [1,] 1.0 0.5 0.5 #> [2,] 0.5 1.0 0.5 #> [3,] 0.5 0.5 1.0#> [,1] [,2] [,3] [,4] #> [1,] 1.0 0.2 0.3 0.4 #> [2,] 0.2 1.0 0.5 0.6 #> [3,] 0.3 0.5 1.0 0.7 #> [4,] 0.4 0.6 0.7 1.0#> [,1] [,2] [,3] [,4] #> [1,] 1.0 0.2 0.3 0.4 #> [2,] 0.2 1.0 0.5 0.6 #> [3,] 0.3 0.5 1.0 0.7 #> [4,] 0.4 0.6 0.7 1.0