Extended Example Ch 6
# load Holzinger and Swineford correlations and name the variables
hs.cor <- matrix(scan(file="HolzingerSwineford.dat"),ncol=14)
# name the variables
colnames(hs.cor) <- rownames(hs.cor) <- c("T1", "T2", "T3.4", "T6","T28", "T29","T32","T34","T35","T36a","T13","T18","T25b","T77")
hs.cor
## T1 T2 T3.4 T6 T28 T29 T32 T34 T35 T36a T13 T18
## T1 1.000 0.514 0.477 0.433 0.424 0.350 0.083 0.239 0.140 0.286 0.305 0.260
## T2 0.514 1.000 0.662 0.497 0.397 0.427 0.152 0.254 0.083 0.368 0.545 0.526
## T3.4 0.477 0.662 1.000 0.415 0.319 0.376 0.173 0.172 0.137 0.229 0.482 0.373
## T6 0.433 0.497 0.415 1.000 0.444 0.530 0.064 0.371 0.214 0.394 0.354 0.348
## T28 0.424 0.397 0.319 0.444 1.000 0.437 0.027 0.211 0.139 0.267 0.262 0.193
## T29 0.350 0.427 0.376 0.530 0.437 1.000 0.018 0.224 0.066 0.340 0.349 0.368
## T32 0.083 0.152 0.173 0.064 0.027 0.018 1.000 0.264 0.203 0.191 0.166 0.115
## T34 0.239 0.254 0.172 0.371 0.211 0.224 0.264 1.000 0.334 0.442 0.202 0.159
## T35 0.140 0.083 0.137 0.214 0.139 0.066 0.203 0.334 1.000 0.234 0.007 -0.014
## T36a 0.286 0.368 0.229 0.394 0.267 0.340 0.191 0.442 0.234 1.000 0.360 0.372
## T13 0.305 0.545 0.482 0.354 0.262 0.349 0.166 0.202 0.007 0.360 1.000 0.677
## T18 0.260 0.526 0.373 0.348 0.193 0.368 0.115 0.159 -0.014 0.372 0.677 1.000
## T25b 0.231 0.437 0.424 0.310 0.160 0.245 0.129 0.053 -0.030 0.235 0.603 0.596
## T77 0.250 0.426 0.368 0.279 0.189 0.273 0.133 0.039 -0.037 0.241 0.586 0.613
## T25b T77
## T1 0.231 0.250
## T2 0.437 0.426
## T3.4 0.424 0.368
## T6 0.310 0.279
## T28 0.160 0.189
## T29 0.245 0.273
## T32 0.129 0.133
## T34 0.053 0.039
## T35 -0.030 -0.037
## T36a 0.235 0.241
## T13 0.603 0.586
## T18 0.596 0.613
## T25b 1.000 0.559
## T77 0.559 1.000
# first-order factor analysis of Holzinger and Swineford’s data - assuming we have looked at our eigenvalues and need to extract 4 factors and doing a oblimin roattion so our factors can correlate
hs.fit4 <- fa(r=hs.cor,nfactors=4,fm="pa",rotate="oblimin")
hs.fit4
## Factor Analysis using method = pa
## Call: fa(r = hs.cor, nfactors = 4, rotate = "oblimin", fm = "pa")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PA1 PA4 PA3 PA2 h2 u2 com
## T1 -0.06 0.44 0.33 0.07 0.43 0.57 2.0
## T2 0.24 0.51 0.20 0.05 0.66 0.34 1.8
## T3.4 0.07 0.80 0.02 0.00 0.72 0.28 1.0
## T6 0.08 0.12 0.55 0.20 0.56 0.44 1.4
## T28 -0.08 0.19 0.55 0.03 0.40 0.60 1.3
## T29 0.14 0.03 0.62 0.01 0.49 0.51 1.1
## T32 0.10 0.18 -0.33 0.43 0.23 0.77 2.4
## T34 -0.03 -0.02 0.07 0.73 0.55 0.45 1.0
## T35 -0.20 0.13 -0.04 0.49 0.26 0.74 1.5
## T36a 0.26 -0.10 0.19 0.49 0.45 0.55 2.0
## T13 0.73 0.11 0.00 0.07 0.67 0.33 1.1
## T18 0.86 -0.09 0.07 0.03 0.72 0.28 1.0
## T25b 0.70 0.14 -0.07 -0.06 0.55 0.45 1.1
## T77 0.72 0.06 -0.01 -0.07 0.54 0.46 1.0
##
## PA1 PA4 PA3 PA2
## SS loadings 2.70 1.59 1.56 1.37
## Proportion Var 0.19 0.11 0.11 0.10
## Cumulative Var 0.19 0.31 0.42 0.52
## Proportion Explained 0.37 0.22 0.22 0.19
## Cumulative Proportion 0.37 0.59 0.81 1.00
##
## With factor correlations of
## PA1 PA4 PA3 PA2
## PA1 1.00 0.52 0.38 0.22
## PA4 0.52 1.00 0.45 0.29
## PA3 0.38 0.45 1.00 0.38
## PA2 0.22 0.29 0.38 1.00
##
## Mean item complexity = 1.4
## Test of the hypothesis that 4 factors are sufficient.
##
## df null model = 91 with the objective function = 5.34
## df of the model are 41 and the objective function was 0.12
##
## The root mean square of the residuals (RMSR) is 0.02
## The df corrected root mean square of the residuals is 0.03
##
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy
## PA1 PA4 PA3 PA2
## Correlation of (regression) scores with factors 0.94 0.90 0.86 0.85
## Multiple R square of scores with factors 0.88 0.81 0.74 0.71
## Minimum correlation of possible factor scores 0.76 0.61 0.48 0.43
# first-order loadings (P01)
P01 <- hs.fit4$loadings
P01
##
## Loadings:
## PA1 PA4 PA3 PA2
## T1 0.438 0.332
## T2 0.241 0.515 0.204
## T3.4 0.802
## T6 0.125 0.545 0.197
## T28 0.190 0.547
## T29 0.138 0.617
## T32 0.103 0.179 -0.333 0.431
## T34 0.727
## T35 -0.198 0.131 0.494
## T36a 0.263 -0.104 0.194 0.486
## T13 0.733 0.114
## T18 0.861
## T25b 0.701 0.136
## T77 0.718
##
## PA1 PA4 PA3 PA2
## SS loadings 2.502 1.257 1.293 1.258
## Proportion Var 0.179 0.090 0.092 0.090
## Cumulative Var 0.179 0.268 0.361 0.451
# first-order factor correlations
F <- hs.fit4$Phi
F
## PA1 PA4 PA3 PA2
## PA1 1.0000000 0.5213963 0.3838230 0.2241397
## PA4 0.5213963 1.0000000 0.4457127 0.2865410
## PA3 0.3838230 0.4457127 1.0000000 0.3793551
## PA2 0.2241397 0.2865410 0.3793551 1.0000000
# second-order factor analysis - take factor correlation (f) and extract one factor
hs.so.fit <- fa(r=F,nfactors=1,fm="pa")
hs.so.fit
## Factor Analysis using method = pa
## Call: fa(r = F, nfactors = 1, fm = "pa")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PA1 h2 u2 com
## PA1 0.63 0.40 0.60 1
## PA4 0.73 0.53 0.47 1
## PA3 0.65 0.43 0.57 1
## PA2 0.44 0.19 0.81 1
##
## PA1
## SS loadings 1.55
## Proportion Var 0.39
##
## Mean item complexity = 1
## Test of the hypothesis that 1 factor is sufficient.
##
## df null model = 6 with the objective function = 0.76
## df of the model are 2 and the objective function was 0.04
##
## The root mean square of the residuals (RMSR) is 0.05
## The df corrected root mean square of the residuals is 0.09
##
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy
## PA1
## Correlation of (regression) scores with factors 0.86
## Multiple R square of scores with factors 0.74
## Minimum correlation of possible factor scores 0.47
# second-order factor loadings (P12)
P12 <- hs.so.fit$loadings
P12
##
## Loadings:
## PA1
## PA1 0.633
## PA4 0.731
## PA3 0.652
## PA2 0.440
##
## PA1
## SS loadings 1.554
## Proportion Var 0.389
# uniquenesses values -
u <- hs.so.fit$uniqueness
u
## PA1 PA4 PA3 PA2
## 0.5990281 0.4655367 0.5748857 0.8062580
# diagonal matrix of square root of uniquenesses
U1 <- diag(sqrt(u))
U1
## [,1] [,2] [,3] [,4]
## [1,] 0.773969 0.0000000 0.0000000 0.0000000
## [2,] 0.000000 0.6823025 0.0000000 0.0000000
## [3,] 0.000000 0.0000000 0.7582122 0.0000000
## [4,] 0.000000 0.0000000 0.0000000 0.8979187
# Schmid–Leiman transformation using matrix multiplication
# second-order factor loadings
P02 <- P01 %*% P12
P02
## PA1
## T1 0.5281063
## T2 0.6856934
## T3.4 0.6399444
## T6 0.5824608
## T28 0.4600154
## T29 0.5154569
## T32 0.1685450
## T34 0.3286477
## T35 0.1632560
## T36a 0.4307925
## T13 0.5781113
## T18 0.5358572
## T25b 0.4712521
## T77 0.4611641
# residualized group loadings
P01r <- P01 %*% U1
P01r
## [,1] [,2] [,3] [,4]
## T1 -0.04757564 0.29855728 0.2516644088 0.062668931
## T2 0.18676386 0.35125664 0.1549521689 0.047494886
## T3.4 0.05117849 0.54691989 0.0155753202 -0.002716869
## T6 0.05983418 0.08520491 0.4134108610 0.176884059
## T28 -0.06169462 0.12977727 0.4145916142 0.030434185
## T29 0.10650156 0.02160041 0.4678234715 0.005882627
## T32 0.07952290 0.12210001 -0.2524422770 0.387061899
## T34 -0.02106427 -0.01627733 0.0503638135 0.652818942
## T35 -0.15288371 0.08967266 -0.0293575959 0.443697646
## T36a 0.20325987 -0.07097086 0.1470440817 0.436741507
## T13 0.56724476 0.07796566 0.0005728192 0.061176245
## T18 0.66655916 -0.06450277 0.0520455966 0.030332000
## T25b 0.54218366 0.09266430 -0.0523521981 -0.054272113
## T77 0.55543606 0.04335190 -0.0083888596 -0.066305558
#Schmid-Leiman through schmid() function
schmid(model=as.matrix(hs.cor),nfactors=4,fm="pa",rotate="oblimin")
## Schmid-Leiman analysis
## Call: schmid(model = as.matrix(hs.cor), nfactors = 4, fm = "pa", rotate = "oblimin")
##
## Schmid Leiman Factor loadings greater than 0.2
## g F1* F2* F3* F4* h2 u2 p2
## T1 0.53 0.25 0.30 0.43 0.57 0.65
## T2 0.69 0.35 0.66 0.34 0.71
## T3.4 0.64 0.55 0.72 0.28 0.57
## T6 0.58 0.41 0.56 0.44 0.60
## T28 0.46 0.41 0.40 0.60 0.53
## T29 0.52 0.47 0.49 0.51 0.54
## T32 -0.25 0.39 0.23 0.77 0.12
## T34 0.33 0.65 0.55 0.45 0.20
## T35 0.44 0.26 0.74 0.10
## T36a 0.43 0.20 0.44 0.45 0.55 0.42
## T13 0.58 0.57 0.67 0.33 0.50
## T18 0.54 0.67 0.72 0.28 0.40
## T25b 0.47 0.54 0.55 0.45 0.40
## T77 0.46 0.56 0.54 0.46 0.39
##
## With eigenvalues of:
## g F1* F2* F3* F4*
## 3.38 1.50 0.74 1.01 0.59
##
## general/max 2.26 max/min = 2.56
## mean percent general = 0.44 with sd = 0.19 and cv of 0.43
##
## The orthogonal loadings were
## Unstandardized loadings based upon covariance matrix
## F1 F2 F3 F4 h2 u2 H2 U2
## T1 0.15 0.50 0.15 0.36 0.43 0.57 0.43 0.57
## T2 0.45 0.47 0.16 0.46 0.66 0.34 0.66 0.34
## T3.4 0.35 0.34 0.13 0.68 0.72 0.28 0.72 0.28
## T6 0.23 0.66 0.24 0.11 0.56 0.44 0.56 0.44
## T28 0.08 0.60 0.09 0.15 0.40 0.60 0.40 0.60
## T29 0.25 0.65 0.06 0.04 0.49 0.51 0.49 0.51
## T32 0.14 -0.10 0.42 0.15 0.23 0.77 0.23 0.77
## T34 0.04 0.28 0.68 -0.04 0.55 0.45 0.55 0.45
## T35 -0.11 0.12 0.47 0.08 0.26 0.74 0.26 0.74
## T36a 0.29 0.36 0.47 -0.07 0.45 0.55 0.45 0.55
## T13 0.75 0.23 0.14 0.17 0.67 0.33 0.67 0.33
## T18 0.81 0.23 0.08 0.01 0.72 0.28 0.72 0.28
## T25b 0.71 0.12 0.01 0.19 0.55 0.45 0.55 0.45
## T77 0.71 0.15 -0.01 0.13 0.54 0.46 0.54 0.46
##
## F1 F2 F3 F4
## SS loadings 2.82 2.19 1.26 0.97
## Proportion Var 0.20 0.16 0.09 0.07
## Cumulative Var 0.20 0.36 0.45 0.52
##
## The degrees of freedom are 41 and the fit is 0.12
##
## The root mean square of the residuals is 0.02
## The df corrected root mean square of the residuals is 0.03