Given the matrices nXm, and jYk, form the super matrix of dimensions (n+j) and (m+k) with with elements x and y along the super diagonal. Useful when considering structural equations. The measurement models x and y can be combined into a larger measurement model of all of the variables. If either x or y is a list of matrices, then recursively form a super matrix of all of those elements. superCor will form a matrix from two matrices and the intercorrelation of the elements of the two.

superMatrix(x,y)
superCor(x,y=NULL, xy=NULL)
super.matrix(x, y)  #Deprecated

Arguments

x

A n x m matrix or a list of such matrices, or the output object from link{scoreOverlap}

y

A j x k matrix or a list of such matrices

xy

A n x k matrix

Details

Several functions, e.g., sim.structural,structure.graph, make.keys use matrices that can be thought of as formed from a set of submatrices. In particular, when using make.keys in order to score a set of items (scoreItems or scoreOverlap) or to form specified clusters (cluster.cor), it is convenient to define different sets of scoring keys for different sets of items and to combine these scoring keys into one super key.

When developing scales and examining items using bestScales it is sometimes helpful to combine the matrix output from scoreOverlap with the original correlation matrix. Thus, let x = correlation of the scales from scoreOverlap, y = the correlations of the items used to form the scales, and xy = the correlation of the scales with the items.

Value

A (n+j) x (m +k) matrix with appropriate row and column names

Author

William Revelle

Examples

mx <- matrix(c(.9,.8,.7,rep(0,4),.8,.7,.6),ncol=2)
my <- matrix(c(.6,.5,.4))

colnames(mx) <- paste("X",1:dim(mx)[2],sep="")
rownames(mx) <- paste("Xv",1:dim(mx)[1],sep="")
colnames(my) <- "Y"
rownames(my) <- paste("Yv",1:3,sep="")
mxy <- superMatrix(mx,my)
#show the use of a list to do this as well
key1 <- make.keys(6,list(first=c(1,-2,3),second=4:6,all=1:6))  #make a scoring key
key2 <- make.keys(4,list(EA=c(1,2),TA=c(3,4)))
superMatrix(list(key1,key2))
#>     first second all EA TA
#> Vx1     1      0   1  0  0
#> Vx2    -1      0   1  0  0
#> Vx3     1      0   1  0  0
#> Vx4     0      1   1  0  0
#> Vx5     0      1   1  0  0
#> Vx6     0      1   1  0  0
#> Vy1     0      0   0  1  0
#> Vy2     0      0   0  1  0
#> Vy3     0      0   0  0  1
#> Vy4     0      0   0  0  1

r <- cor(bfi[1:15],use="pairwise")
bfi.scores <- scoreOverlap(bfi.keys[1:2], r,select=FALSE) #note the select = FALSE
R <- superCor(bfi.scores,r)
lowerMat(R)
#>               agree cnscn A1    A2    A3    A4    A5    C1    C2    C3    C4   
#> agree          1.00                                                            
#> conscientious  0.25  1.00                                                      
#> A1            -0.39 -0.06  1.00                                                
#> A2             0.68  0.26 -0.34  1.00                                          
#> A3             0.72  0.24 -0.27  0.49  1.00                                    
#> A4             0.49  0.32 -0.15  0.34  0.36  1.00                              
#> A5             0.63  0.25 -0.18  0.39  0.50  0.31  1.00                        
#> C1             0.13  0.59  0.03  0.09  0.10  0.09  0.12  1.00                  
#> C2             0.22  0.67  0.02  0.14  0.14  0.23  0.11  0.43  1.00            
#> C3             0.22  0.59 -0.02  0.19  0.13  0.13  0.13  0.31  0.36  1.00      
#> C4            -0.24 -0.70  0.13 -0.15 -0.12 -0.15 -0.13 -0.34 -0.38 -0.34  1.00
#> C5            -0.26 -0.63  0.05 -0.12 -0.16 -0.24 -0.17 -0.25 -0.30 -0.34  0.48
#> E1            -0.32 -0.06  0.11 -0.21 -0.21 -0.11 -0.25 -0.02  0.02  0.00  0.09
#> E2            -0.40 -0.26  0.09 -0.23 -0.29 -0.19 -0.33 -0.09 -0.06 -0.08  0.20
#> E3             0.46  0.22 -0.05  0.25  0.39  0.19  0.42  0.12  0.15  0.09 -0.08
#> E4             0.53  0.25 -0.06  0.28  0.38  0.30  0.47  0.14  0.12  0.09 -0.11
#> E5             0.36  0.44 -0.02  0.29  0.25  0.16  0.27  0.25  0.25  0.21 -0.24
#>    C5    E1    E2    E3    E4    E5   
#> C5  1.00                              
#> E1  0.06  1.00                        
#> E2  0.26  0.47  1.00                  
#> E3 -0.16 -0.33 -0.38  1.00            
#> E4 -0.20 -0.42 -0.51  0.42  1.00      
#> E5 -0.23 -0.30 -0.37  0.38  0.32  1.00
#or to just get the scale correlations with the items
R <- superCor(bfi.scores)
round(R,2)
#>               agree conscientious
#> agree          1.00          0.25
#> conscientious  0.25          1.00
#> A1            -0.39         -0.06
#> A2             0.68          0.26
#> A3             0.72          0.24
#> A4             0.49          0.32
#> A5             0.63          0.25
#> C1             0.13          0.59
#> C2             0.22          0.67
#> C3             0.22          0.59
#> C4            -0.24         -0.70
#> C5            -0.26         -0.63
#> E1            -0.32         -0.06
#> E2            -0.40         -0.26
#> E3             0.46          0.22
#> E4             0.53          0.25
#> E5             0.36          0.44