# Examples

# Summary

Exploratory factor analysis (EFA) (Gorsuch, 1983) is a popular statistical method in many disciplines (e.g., the social and behavioral sciences, education, and medical sciences). Researchers use EFA to study constructs (e.g., intelligence, personality traits, and emotion) whose measurements (e.g., questionnaires and wearable sensors) are often contaminated with error. These constructs are called latent factors and their measurements are called observed variables. The latent factors provide a parsimonious explanation of the relations among observed variables. EFA involves determining the number factors, extracting the unrotated factor loading matrix, rotating the matrix, and interpreting the EFA results. The EFAutilities package utilizes four utility functions for EFA and related methods. In particular, it computes standard errors for rotated factor loadings and factor correlations under a variety of conditions (Browne, 2001; Zhang, 2014).

The R package EFAutilities includes four functions (efa, ssem, efaMR, and Align.matrix) and two data sets (CPAI537 and BFI228). In the rest of the vignette, we first describes the functions and the data sets, then illustrate the functions with several examples.

# Functions

efa()
The function `efa()` is the main function in the package. It conducts EFA with either raw data or a correlation matrix. Four types of raw data are allowed: normal, non-normal continuous variables, Likert variables, and time series data. The function allows researcher to extract factors using either ordinary least squares (OLS) or maximum likelihood (ML). Both oblique rotation or orthogonal rotation are available with seven rotation criteria (CF-varimax, CF-quartimax, CF-facparsim, CF-equamax, CF-parsimax, geomin, and target). These rotation criteria are a subset of rotation criteria considered in CEFA3.0 (Browne, Cudeck, Tateneni, & Mels, 2010). A rotation criterion xtarget is a new development (Zhang, Hattori, Trichtinger, & Wang, 2018) that allows researchers to specify targets on both factor loadings and factor correlations. Researchers can choose four methods (information, sandwich, bootstrap, and jackknife) to estimate standard errors for rotated factor loadings and factor correlations.

ssem()
The function `ssem()` is a newly developed method that allows both exogenous factors and endogenous factors (Zhang, Hattori, and Trichtinger, in press). All factors are exogenous in EFA, but factors can be either exogenous or endogenous in this rotation method. We refer to this new rotation method as FSP (factor simple path). It allows researchers (1) to explore directional relations among common factors with flexible factor loading matrices and (2) to reexamine a SEM model that fit data poorly or encountered estimation problems like Heywood cases or non-convergence.

efaMR()
The function `efaMR()` compares EFA results from multiple random starts or from multiple rotation criteria. Researchers can use it to assess the computational stability of a rotation method. Hattori, Zhang, and Preacher (2017) investigate the phenomenon of local solutions for geomin rotation in a variety of situation. The functions `efaMR()` and `efa()` share many arguments, but it includes additional ones like `input.A`, `additionalRC`, `nstart`, `compare`, and `geomin.delta`.

Align.matrix()
The function `Align.Matrix()` aligns a rotated factor loading matrix against an order matrix. Researchers can use it resolve the alignment problem, which refers to the phenomenon that the sign and ordering of factors are arbitrary in a factor loading matrix. Failing to resolve the alignment problem has a detrimental effect when comparing multiple factor analysis results. The function Align.matrix minimizes the sum of squared deviation between the rotated factor loading matrix and the order matrix. Because the function considers every possible ordering of the rotated factor loading matrix, the computational cost can be high if there are too many factors.

# Data Description

This package includes two data sets. The first one includes 228 undergraduate students self ratings on the 44 items in the Big Five Inventory (John, Donahue, & Kentle, 1991). It is part of a study on personality and relationship satisfaction (Luo, 2005). The ratings are five-point Likert items: disagree strongly (1), disagree a little (2), neither agree nor disagree (3), agree a little (4), and agree strongly (5). The data are presented as a n by p matrix of ordinal variables, where n is the number of participants (228) and p is the number of manifest variables (44).

The second one includes 28 composite scores of the Chinese personality inventory (Cheung et al., 1996) CPAI537. This data is part of a study on martial satisfaction (Luo et al., 2008). Participants of the study were 537 urban Chinese couples within the first year of their first marriage. The data are composite scores of the 537 wives. The data are presented as a n by p matrix, where n is the number of participants (537) and p is the number of manifest variables (28).

# Illustration Examples

We illustrate EFAutilities with six examples. Example 1 illustrates EFA with continuous non-normal data; Example 2 illustrates EFA with ordinal data; Example 3 illustrates EFA with correlated residuals; Example 4 illustrates SSEM (FSP); Example 5 illustrates rotation with multiple random starting points; Example 6 illustrates how to re-align a rotated factor loading matrix against an order matrix.

## Example 1

In Example 1, we fit a 4-factor model to the `CPAI537` data. We obtained unrotated factor loadings using ml and we conduct oblique CF-varimax rotation. We compute standard errors for rotated factor loadings and factor correlations using a sandwich method.

    library(EFAutilities)
    data("CPAI537")

    mnames=c("Nov", "Div", "Dit","LEA","L_A", "AES", "E_I", "ENT", "RES", "EMO", "I_S",
             "PRA", "O_P", "MET", "FAC", "I_E", "FAM", "DEF", "G_M", "INT", "S_S",
             "V_S", "T_M", "REN", "SOC", "DIS", "HAR", "T_E")

    res1 <- efa(x=CPAI537,factors=4, fm='ml', mnames=mnames)
    res1

    ##
    ## Summary of Analysis:
    ##    Estimation Method:   ml
    ##    Rotation Type:   oblique
    ##    Rotation Criterion:   CF-varimax
    ##    Test Statistic:   545
    ##    Degrees of Freedom:   272
    ##    Effect numbers of Parameters:   134
    ##    P value for perfect fit:   0
    ##
    ## Rotated Factor Loadings:
    ##         F1     F2     F3     F4
    ## Nov -0.117  0.674  0.146 -0.021
    ## Div -0.191  0.530  0.386 -0.145
    ## Dit  0.139  0.461  0.313  0.007
    ## LEA  0.297  0.672 -0.084 -0.036
    ## L_A  0.068  0.471  0.176  0.161
    ## AES  0.128  0.345  0.215 -0.093
    ## E_I  0.001  0.565 -0.067  0.104
    ## ENT -0.096  0.536 -0.272  0.425
    ## RES  0.065  0.004  0.120  0.620
    ## EMO -0.049  0.030  0.062 -0.750
    ## I_S  0.440 -0.218 -0.191 -0.461
    ## PRA  0.025  0.035  0.263  0.505
    ## O_P -0.159  0.285 -0.009  0.476
    ## MET  0.175  0.012  0.052  0.537
    ## FAC  0.311  0.058  0.238 -0.278
    ## I_E -0.373  0.021 -0.074  0.223
    ## FAM -0.281 -0.020  0.378  0.375
    ## DEF  0.636  0.141 -0.174 -0.259
    ## G_M -0.617 -0.053  0.228  0.236
    ## INT -0.540  0.204  0.161  0.076
    ## S_S  0.589  0.209 -0.019 -0.126
    ## V_S -0.477 -0.121  0.383  0.255
    ## T_M  0.625 -0.157  0.076  0.263
    ## REN  0.092  0.036  0.724 -0.073
    ## SOC  0.139  0.294  0.602 -0.060
    ## DIS  0.729  0.058  0.298  0.182
    ## HAR -0.173 -0.029  0.648  0.250
    ## T_E  0.188 -0.136  0.357  0.075
    ##
    ## Factor Correlations:
    ##        F1    F2     F3     F4
    ## F1  1.000 0.058 -0.144 -0.313
    ## F2  0.058 1.000  0.207  0.101
    ## F3 -0.144 0.207  1.000  0.301
    ## F4 -0.313 0.101  0.301  1.000

The basic output is a brief summary of the analysis, a rotated factor loading matrix and a factor correlation matrix. We can request more detailed output using the `moredetail` option.

    print (res1, moredetail=TRUE)

    ##
    ## Analysis Details:
    ##    Number of Manifest Variable:   28
    ##    Number of Factors:   4
    ##    Sample Size:   537
    ##    Manifest Variable Distribution:   normal
    ##    Estimation Method:   ml
    ##    Rotation Type:   oblique
    ##    Rotation Criterion:   CF-varimax
    ##    Rotation Standardization:   FALSE
    ##    Standard Error:   sandwich
    ##
    ## Measures of Fit
    ##  Root Mean Square Error of Approximation, RMSEA
    ##    Point estimate:   0.043
    ##    90 % Confidence Intervals:  ( 0.038 , 0.048 )
    ##    Test Statistic:   545
    ##    Degrees of Freedom:   272
    ##    Effect numbers of Parameters:   134
    ##    P value for perfect fit:   0
    ##    P value for close fit:   0.984
    ##
    ## Eigenvalues, SMCs, Communalities, and Unique Variance:
    ##      Eval   SMC  Comm  UniV
    ## Nov 6.705 0.462 0.519 0.481
    ## Div 4.076 0.458 0.515 0.485
    ## Dit 2.114 0.372 0.385 0.615
    ## LEA 1.867 0.493 0.559 0.441
    ## L_A 1.184 0.368 0.344 0.656
    ## AES 0.963 0.240 0.207 0.793
    ## E_I 0.833 0.374 0.327 0.673
    ## ENT 0.798 0.409 0.480 0.520
    ## RES 0.761 0.418 0.421 0.579
    ## EMO 0.700 0.421 0.516 0.484
    ## I_S 0.648 0.683 0.721 0.279
    ## PRA 0.618 0.397 0.405 0.595
    ## O_P 0.608 0.392 0.398 0.602
    ## MET 0.524 0.274 0.279 0.721
    ## FAC 0.516 0.268 0.231 0.769
    ## I_E 0.511 0.245 0.228 0.772
    ## FAM 0.486 0.548 0.541 0.459
    ## DEF 0.467 0.639 0.677 0.323
    ## G_M 0.460 0.618 0.652 0.348
    ## INT 0.454 0.413 0.427 0.573
    ## S_S 0.418 0.506 0.465 0.535
    ## V_S 0.407 0.600 0.623 0.377
    ## T_M 0.396 0.353 0.361 0.639
    ## REN 0.345 0.440 0.502 0.498
    ## SOC 0.318 0.455 0.506 0.494
    ## DIS 0.296 0.469 0.558 0.442
    ## HAR 0.272 0.601 0.661 0.339
    ## T_E 0.255 0.200 0.149 0.851
    ##
    ## Unrotated Factor Loadings:
    ##         F1     F2     F3     F4
    ## Nov  0.308  0.539 -0.341  0.131
    ## Div  0.386  0.485 -0.175  0.317
    ## Dit  0.202  0.577 -0.043  0.097
    ## LEA -0.146  0.658 -0.320 -0.061
    ## L_A  0.287  0.494 -0.128 -0.034
    ## AES  0.048  0.433 -0.045  0.122
    ## E_I  0.161  0.426 -0.339 -0.067
    ## ENT  0.340  0.273 -0.428 -0.326
    ## RES  0.499  0.108  0.153 -0.370
    ## EMO -0.488  0.002 -0.085  0.520
    ## I_S -0.835 -0.038  0.122  0.092
    ## PRA  0.537  0.171  0.185 -0.230
    ## O_P  0.532  0.154 -0.166 -0.252
    ## MET  0.315  0.142  0.142 -0.373
    ## FAC -0.274  0.305  0.170  0.185
    ## I_E  0.397 -0.206 -0.155 -0.067
    ## FAM  0.719  0.010  0.155 -0.020
    ## DEF -0.733  0.367  0.022 -0.071
    ## G_M  0.755 -0.264 -0.039  0.104
    ## INT  0.593 -0.052 -0.208  0.171
    ## S_S -0.486  0.467  0.064 -0.081
    ## V_S  0.750 -0.176  0.132  0.109
    ## T_M -0.239  0.246  0.374 -0.321
    ## REN  0.338  0.388  0.385  0.298
    ## SOC  0.296  0.567  0.195  0.242
    ## DIS -0.189  0.568  0.398 -0.204
    ## HAR  0.712  0.173  0.325  0.133
    ## T_E  0.114  0.147  0.337  0.029
    ##
    ## Rotated Factor Loadings:
    ##         F1     F2     F3     F4
    ## Nov -0.117  0.674  0.146 -0.021
    ## Div -0.191  0.530  0.386 -0.145
    ## Dit  0.139  0.461  0.313  0.007
    ## LEA  0.297  0.672 -0.084 -0.036
    ## L_A  0.068  0.471  0.176  0.161
    ## AES  0.128  0.345  0.215 -0.093
    ## E_I  0.001  0.565 -0.067  0.104
    ## ENT -0.096  0.536 -0.272  0.425
    ## RES  0.065  0.004  0.120  0.620
    ## EMO -0.049  0.030  0.062 -0.750
    ## I_S  0.440 -0.218 -0.191 -0.461
    ## PRA  0.025  0.035  0.263  0.505
    ## O_P -0.159  0.285 -0.009  0.476
    ## MET  0.175  0.012  0.052  0.537
    ## FAC  0.311  0.058  0.238 -0.278
    ## I_E -0.373  0.021 -0.074  0.223
    ## FAM -0.281 -0.020  0.378  0.375
    ## DEF  0.636  0.141 -0.174 -0.259
    ## G_M -0.617 -0.053  0.228  0.236
    ## INT -0.540  0.204  0.161  0.076
    ## S_S  0.589  0.209 -0.019 -0.126
    ## V_S -0.477 -0.121  0.383  0.255
    ## T_M  0.625 -0.157  0.076  0.263
    ## REN  0.092  0.036  0.724 -0.073
    ## SOC  0.139  0.294  0.602 -0.060
    ## DIS  0.729  0.058  0.298  0.182
    ## HAR -0.173 -0.029  0.648  0.250
    ## T_E  0.188 -0.136  0.357  0.075
    ##
    ## Factor Correlations:
    ##        F1    F2     F3     F4
    ## F1  1.000 0.058 -0.144 -0.313
    ## F2  0.058 1.000  0.207  0.101
    ## F3 -0.144 0.207  1.000  0.301
    ## F4 -0.313 0.101  0.301  1.000
    ##
    ## Unique Variances:
    ##   Nov   Div   Dit   LEA   L_A   AES   E_I   ENT   RES   EMO   I_S   PRA   O_P
    ## 0.481 0.485 0.615 0.441 0.656 0.793 0.673 0.520 0.579 0.484 0.279 0.595 0.602
    ##   MET   FAC   I_E   FAM   DEF   G_M   INT   S_S   V_S   T_M   REN   SOC   DIS
    ## 0.721 0.769 0.772 0.459 0.323 0.348 0.573 0.535 0.377 0.639 0.498 0.494 0.442
    ##   HAR   T_E
    ## 0.339 0.851
    ##
    ## SE for rotated Factor Loadings:
    ##        F1    F2    F3    F4
    ## Nov 0.036 0.036 0.051 0.043
    ## Div 0.039 0.053 0.056 0.041
    ## Dit 0.044 0.051 0.058 0.047
    ## LEA 0.046 0.033 0.053 0.041
    ## L_A 0.043 0.044 0.054 0.048
    ## AES 0.050 0.055 0.061 0.055
    ## E_I 0.041 0.042 0.050 0.059
    ## ENT 0.039 0.057 0.043 0.063
    ## RES 0.043 0.038 0.047 0.044
    ## EMO 0.036 0.040 0.038 0.031
    ## I_S 0.046 0.036 0.042 0.042
    ## PRA 0.051 0.040 0.046 0.044
    ## O_P 0.044 0.048 0.043 0.051
    ## MET 0.045 0.043 0.049 0.048
    ## FAC 0.049 0.055 0.056 0.057
    ## I_E 0.046 0.048 0.053 0.054
    ## FAM 0.058 0.038 0.050 0.045
    ## DEF 0.049 0.035 0.054 0.043
    ## G_M 0.051 0.037 0.053 0.045
    ## INT 0.040 0.042 0.047 0.046
    ## S_S 0.049 0.049 0.062 0.055
    ## V_S 0.060 0.038 0.055 0.043
    ## T_M 0.045 0.041 0.048 0.049
    ## REN 0.043 0.048 0.034 0.042
    ## SOC 0.040 0.052 0.045 0.040
    ## DIS 0.037 0.035 0.046 0.043
    ## HAR 0.053 0.039 0.040 0.041
    ## T_E 0.055 0.056 0.053 0.064
    ##
    ## SE for Factor Correlations:
    ##       F1    F2    F3    F4
    ## F1 0.000 0.038 0.033 0.028
    ## F2 0.038 0.000 0.034 0.037
    ## F3 0.033 0.034 0.000 0.034
    ## F4 0.028 0.037 0.034 0.000
    ##
    ## SE for Unique Variances:
    ##   Nov   Div   Dit   LEA   L_A   AES   E_I   ENT   RES   EMO   I_S   PRA   O_P
    ## 0.021 0.023 0.021 0.023 0.021 0.019 0.022 0.029 0.022 0.021 0.017 0.020 0.021
    ##   MET   FAC   I_E   FAM   DEF   G_M   INT   S_S   V_S   T_M   REN   SOC   DIS
    ## 0.022 0.020 0.018 0.020 0.017 0.017 0.020 0.020 0.020 0.025 0.023 0.023 0.024
    ##   HAR   T_E
    ## 0.019 0.019
    ##
    ## Lower Bounds of 95 % CIs for Rotated Factor Loadings:
    ##         F1     F2     F3     F4
    ## Nov -0.187  0.603  0.047 -0.105
    ## Div -0.267  0.427  0.275 -0.226
    ## Dit  0.052  0.360  0.199 -0.084
    ## LEA  0.206  0.607 -0.188 -0.117
    ## L_A -0.016  0.386  0.071  0.067
    ## AES  0.029  0.238  0.097 -0.200
    ## E_I -0.080  0.482 -0.165 -0.012
    ## ENT -0.172  0.424 -0.357  0.301
    ## RES -0.019 -0.071  0.027  0.534
    ## EMO -0.120 -0.048 -0.013 -0.812
    ## I_S  0.350 -0.287 -0.274 -0.544
    ## PRA -0.075 -0.044  0.172  0.419
    ## O_P -0.245  0.192 -0.094  0.376
    ## MET  0.087 -0.073 -0.044  0.443
    ## FAC  0.216 -0.049  0.127 -0.389
    ## I_E -0.462 -0.073 -0.178  0.118
    ## FAM -0.395 -0.095  0.280  0.288
    ## DEF  0.541  0.072 -0.280 -0.343
    ## G_M -0.717 -0.125  0.124  0.149
    ## INT -0.618  0.121  0.068 -0.014
    ## S_S  0.493  0.113 -0.140 -0.233
    ## V_S -0.594 -0.196  0.275  0.170
    ## T_M  0.537 -0.238 -0.019  0.166
    ## REN  0.009 -0.057  0.658 -0.155
    ## SOC  0.061  0.192  0.514 -0.138
    ## DIS  0.656 -0.011  0.208  0.097
    ## HAR -0.278 -0.104  0.568  0.169
    ## T_E  0.080 -0.245  0.252 -0.052
    ##
    ## Upper Bounds of 95 % CIs for Rotated Factor Loadings:
    ##         F1     F2     F3     F4
    ## Nov -0.046  0.744  0.246  0.064
    ## Div -0.114  0.634  0.496 -0.065
    ## Dit  0.226  0.561  0.427  0.098
    ## LEA  0.388  0.738  0.021  0.045
    ## L_A  0.153  0.557  0.281  0.255
    ## AES  0.227  0.452  0.334  0.013
    ## E_I  0.081  0.648  0.031  0.219
    ## ENT -0.020  0.649 -0.187  0.549
    ## RES  0.148  0.079  0.212  0.706
    ## EMO  0.023  0.109  0.137 -0.688
    ## I_S  0.530 -0.148 -0.109 -0.379
    ## PRA  0.126  0.113  0.355  0.591
    ## O_P -0.073  0.378  0.076  0.575
    ## MET  0.264  0.097  0.149  0.630
    ## FAC  0.406  0.165  0.348 -0.167
    ## I_E -0.283  0.115  0.031  0.328
    ## FAM -0.166  0.055  0.476  0.463
    ## DEF  0.732  0.211 -0.068 -0.175
    ## G_M -0.517  0.019  0.332  0.324
    ## INT -0.463  0.286  0.254  0.167
    ## S_S  0.685  0.306  0.101 -0.019
    ## V_S -0.360 -0.046  0.491  0.339
    ## T_M  0.712 -0.077  0.170  0.360
    ## REN  0.176  0.129  0.790  0.008
    ## SOC  0.217  0.396  0.691  0.018
    ## DIS  0.803  0.128  0.387  0.268
    ## HAR -0.068  0.047  0.727  0.330
    ## T_E  0.296 -0.027  0.461  0.201
    ##
    ## Lower Bounds of 95 % CIs for Factor Correlations:
    ##        F1     F2     F3     F4
    ## F1  1.000 -0.017 -0.208 -0.368
    ## F2 -0.017  1.000  0.139  0.028
    ## F3 -0.208  0.139  1.000  0.233
    ## F4 -0.368  0.028  0.233  1.000
    ##
    ## Upper Bounds of 95 % CIs for Factor Correlations:
    ##        F1    F2     F3     F4
    ## F1  1.000 0.133 -0.078 -0.256
    ## F2  0.133 1.000  0.272  0.174
    ## F3 -0.078 0.272  1.000  0.367
    ## F4 -0.256 0.174  0.367  1.000
    ##
    ## Lower Bounds of 95 % CIs for Unique Variances:
    ##   Nov   Div   Dit   LEA   L_A   AES   E_I   ENT   RES   EMO   I_S   PRA   O_P
    ## 0.440 0.441 0.573 0.396 0.614 0.754 0.630 0.464 0.536 0.443 0.247 0.555 0.560
    ##   MET   FAC   I_E   FAM   DEF   G_M   INT   S_S   V_S   T_M   REN   SOC   DIS
    ## 0.677 0.726 0.735 0.420 0.291 0.316 0.534 0.495 0.339 0.589 0.453 0.449 0.395
    ##   HAR   T_E
    ## 0.303 0.809
    ##
    ## Upper Bounds of 95 % CIs for Unique Variances:
    ##   Nov   Div   Dit   LEA   L_A   AES   E_I   ENT   RES   EMO   I_S   PRA   O_P
    ## 0.521 0.530 0.654 0.486 0.695 0.827 0.714 0.575 0.621 0.526 0.313 0.635 0.642
    ##   MET   FAC   I_E   FAM   DEF   G_M   INT   S_S   V_S   T_M   REN   SOC   DIS
    ## 0.762 0.806 0.805 0.497 0.358 0.382 0.611 0.573 0.417 0.687 0.542 0.539 0.489
    ##   HAR   T_E
    ## 0.377 0.884

We can access even more detailed results by the `$` command. For example, we can examine the test statistic and measures of model fit using the following commands:

    res1$ModelF

    ## $f.stat
    ## Discrepancy
    ##         545
    ##
    ## $df
    ## [1] 272
    ##
    ## $n
    ## [1] 537
    ##
    ## $RMSEA
    ## Discrepancy
    ##      0.0432
    ##
    ## $p.perfect
    ## Discrepancy
    ##           0
    ##
    ## $p.close
    ## Discrepancy
    ##       0.984
    ##
    ## $confid.level
    ## [1] 0.9
    ##
    ## $RMSEA.l
    ## [1] 0.0379
    ##
    ## $RMSEA.u
    ## [1] 0.0485
    ##
    ## $ECVI
    ## Discrepancy
    ##        1.51
    ##
    ## $ECVI.l
    ## [1] 1.42
    ##
    ## $ECVI.u
    ## [1] 1.68

## Example 2

In Example 2, we fit a 2-factor model to the data `BFI228`. The data contains 5-point Likert variables. We first estimate polychoric correlations from the Likert variable. We then obtain the unrotated factor loading matrix from the polychoric correlation matrix using ols. We conduct oblique geomin rotation. We compute standard errors using a sandwich method. The efa model involve only 17 variables out of 44 variables for the illustration purpose.

    data("BFI228")
    reduced2 <- BFI228[,1:17]

Since the data use Likert variables, we set the argument `dist` to be `ordinal`. We can also include an argument for model error. By default, an efa model is a parsimonious representation to the complex real world. Thus, we expect some amount of model error. However, users can specify `merror='NO'`, if they believe their efa model fits perfectly in the population.

    mnames=c("talkative", "reserved_R", "fullenergy", "enthusiastic", "quiet_R","assertive",
             "shy_R", "outgoing", "findfault_R", "helpful", "quarrels_R", "forgiving",
             "trusting", "cold_R", "considerate", "rude_R", "cooperative")

    res2 <-efa(x=reduced2, factors=2, dist="ordinal", rotation="geomin", merror="YES",
               mnames=mnames)
    res2

    ##
    ## Summary of Analysis:
    ##    Estimation Method:   ols
    ##    Rotation Type:   oblique
    ##    Rotation Criterion:   geomin
    ##    Test Statistic:   298
    ##    Degrees of Freedom:   103
    ##    Effect numbers of Parameters:   50
    ##    P value for perfect fit:   0
    ##
    ## Rotated Factor Loadings:
    ##                  F1     F2
    ## talkative     0.772 -0.036
    ## reserved_R   -0.589 -0.021
    ## fullenergy    0.588  0.378
    ## enthusiastic  0.662  0.361
    ## quiet_R      -0.854  0.078
    ## assertive     0.635 -0.025
    ## shy_R        -0.704  0.096
    ## outgoing      0.792  0.165
    ## findfault_R  -0.057 -0.520
    ## helpful      -0.031  0.591
    ## quarrels_R    0.123 -0.726
    ## forgiving     0.040  0.611
    ## trusting      0.108  0.629
    ## cold_R       -0.102 -0.744
    ## considerate  -0.131  0.759
    ## rude_R        0.078 -0.713
    ## cooperative   0.181  0.634
    ##
    ## Factor Correlations:
    ##       F1    F2
    ## F1 1.000 0.209
    ## F2 0.209 1.000

## Example 3

In Example 3, we illustrate EFA with correlated residuals. The data is a subset of the study reported by Watson Clark & Tellegen, A. (1988). The original data set contains 20 items, but we consider only 8 items.

     xcor <- matrix(c(
      1.00,  0.37,  0.29,  0.43, -0.07, -0.05, -0.04, -0.01,
      0.37,  1.00,  0.51,  0.37, -0.03, -0.03, -0.06, -0.03,
      0.29,  0.51,  1.00,  0.37, -0.03, -0.01, -0.02, -0.04,
      0.43,  0.37,  0.37,  1.00, -0.03, -0.03, -0.02, -0.01,
     -0.07, -0.03, -0.03, -0.03,  1.00,  0.61,  0.41,  0.32,
     -0.05, -0.03, -0.01, -0.03,  0.61,  1.00,  0.47,  0.38,
     -0.04, -0.06, -0.02, -0.02,  0.41,  0.47,  1.00,  0.47,
     -0.01, -0.03, -0.04, -0.01,  0.32,  0.38,  0.47,  1.00),
     ncol=8)

     n.cr=2
     I.cr = matrix(0,n.cr,2)

     I.cr[1,1] = 5
     I.cr[1,2] = 6
     I.cr[2,1] = 7
     I.cr[2,2] = 8

     efa(covmat=xcor,factors=2, n.obs=1657, I.cr=I.cr)

    ##
    ## Summary of Analysis:
    ##    Estimation Method:   ols
    ##    Rotation Type:   oblique
    ##    Rotation Criterion:   CF-varimax
    ##    Test Statistic:   87.6
    ##    Degrees of Freedom:   11
    ##    Effect numbers of Parameters:   25
    ##    P value for perfect fit:   0
    ##
    ## Rotated Factor Loadings:
    ##         F1     F2
    ## MV1 -0.030  0.557
    ## MV2 -0.004  0.695
    ## MV3  0.011  0.637
    ## MV4  0.003  0.610
    ## MV5  0.780 -0.022
    ## MV6  0.949  0.008
    ## MV7  0.494 -0.029
    ## MV8  0.393 -0.015
    ##
    ## Factor Correlations:
    ##        F1     F2
    ## F1  1.000 -0.049
    ## F2 -0.049  1.000

## Example 4

In Example 4, we illustrate FSP with a correlation matrix (Reisenzein, 1986). The original study was on an attribution theory of helping behaviors. The sample size was 138. The SSEM involves 9 manifest variables and 3 latent factors. We expect that an uncontrollable need results in sympathy toward the help-seeker and sympathy further leads to helping behavior. Therefore, we denote the two factors “helping behavior” and “sympathy” as endogenous and the factor “controllability” as exogenous.

    cormat <- matrix(c(1, .865, .733, .511, .412, .647, -.462, -.533, -.544,
                      .865, 1, .741, .485, .366, .595, -.406, -.474, -.505,
                      .733, .741, 1, .316, .268, .497, -.303, -.372, -.44,
                      .511, .485, .316, 1, .721, .731, -.521, -.531, -.621,
                      .412, .366, .268, .721, 1, .599, -.455, -.425, -.455,
                      .647, .595, .497, .731, .599, 1, -.417, -.47, -.521,
                     -.462, -.406, -.303, -.521, -.455, -.417, 1, .747, .727,
                     -.533, -.474, -.372, -.531, -.425, -.47, .747, 1, .772,
                     -.544, -.505, -.44, -.621, -.455, -.521, .727, .772, 1),
                     ncol = 9)

    p <- 9
    m <- 3
    m1 <- 2
    N <- 138
    mvnames <- c("H1_likelihood", "H2_certainty", "H3_amount", "S1_sympathy",
    "S2_pity", "S3_concern", "C1_controllable", "C2_responsible", "C3_fault")
    fnames <- c("H", "S", "C")

Next, we want to prepare our target and weight matrices based on our theory. For the target matrix, a 9 indicates a value that is allowed to be freely estimated. We set the other values to be rotation as close to 0 as possible. The weight matrix has 1 in the places where the target matrix has zeros and otherwise zero.

    # a 9 x 3 matrix for lambda; p = 9, m = 3
    MT <- matrix(0, p, m, dimnames = list(mvnames, fnames))
    MT[c(1:3,6),1] <- 9
    MT[4:6,2] <- 9
    MT[7:9,3] <- 9
    MW <- matrix(0, p, m, dimnames = list(mvnames, fnames))
    MW[MT == 0] <- 1
    # a 2 x 3 matrix for [B|G]; m1 = 2, m = 3
    BGT <- matrix(0, m1, m, dimnames = list(fnames[1:m1], fnames))
    BGT[1,2] <- 9
    BGT[2,3] <- 9
    BGT[1,3] <- 9
    BGW <- matrix(0, m1, m, dimnames = list(fnames[1:m1], fnames))
    BGW[BGT == 0] <- 1
    BGW[,1] <- 0
    BGW[2,2] <- 0
    # a 1 x 1 matrix for Phi.xi; m - m1 = 1 (only one exogenous factor)
    PhiT <- matrix(9, m - m1, m - m1)
    PhiW <- matrix(0, m - m1, m - m1)

We can then run the ssem function by

    SSEMres <- ssem(covmat = cormat, factors = m, exfactors = m - m1,
    dist = "normal", n.obs = N, fm = "ml", rotation = "semtarget",
    maxit = 10000, MTarget = MT, MWeight = MW, BGTarget = BGT, BGWeight = BGW,
    PhiTarget = PhiT, PhiWeight = PhiW,  useorder = TRUE, se = "information",
    mnames = mvnames, fnames = fnames)

    ## The fisher information SEs are valid only for normal data and no model error. Sandwich SEs are computed.

    SSEMres

    ##
    ## Summary of Analysis:
    ##    Estimation Method:   ml
    ##    Rotation Criterion:   semtarget
    ##    Test Statistic:   12.8
    ##    Degrees of Freedom:   12
    ##    Effect numbers of Parameters:   33
    ##    P value for perfect fit:   0.386
    ##
    ## Rotated Factor Loadings:
    ##                      H      S      C
    ## H1_likelihood    0.877  0.049 -0.057
    ## H2_certainty     0.912  0.047  0.021
    ## H3_amount        0.849 -0.100 -0.003
    ## S1_sympathy      0.008  0.927 -0.039
    ## S2_pity          0.004  0.728 -0.039
    ## S3_concern       0.384  0.621  0.078
    ## C1_controllable  0.063  0.005  0.880
    ## C2_responsible  -0.025  0.068  0.920
    ## C3_fault        -0.051 -0.096  0.779
    ##
    ## Latent Regression Weights:
    ##   H     S      C
    ## H 0 0.224 -0.427
    ## S 0 0.000 -0.641
    ##
    ## Latent Residual Variances:
    ##     H     S
    ## 0.645 0.589
    ##
    ## Exogenous Factor Correlations:
    ##   C
    ## C 1

## Example 5

In Example 5, we use the `efaMR` to compare EFA solutions from 100 random orthogonal starts. We fit a 5-factor model to the data ``CPAI537’ data fit then obtain the unrotated factor loading matrix from using ml. We conduct oblique geomin rotation.

    efaMRres <-efaMR(CPAI537, factors = 5, fm ='ml', rtype ='oblique', rotation ='geomin',
                 geomin.delta = .01, nstart = 100)

    #res3$MultipleSolutions for more details
    efaMRres$MultipleSolutions$FrequenciesSolutions

    ## [1] 23 10 44 14  6  2  1

    efaMRres$MultipleSolutions$Solutions[[1]]

    ## $Lambda
    ##         [,1]   [,2]   [,3]   [,4]   [,5]
    ##  [1,]  0.641 -0.062  0.229  0.010  0.125
    ##  [2,]  0.492 -0.275  0.321  0.010  0.106
    ##  [3,]  0.386 -0.225  0.035  0.002  0.275
    ##  [4,]  0.661  0.028 -0.089 -0.285  0.089
    ##  [5,]  0.412 -0.066  0.016  0.152  0.272
    ##  [6,]  0.235 -0.127  0.074 -0.107  0.331
    ##  [7,]  0.727 -0.016 -0.025 -0.011 -0.316
    ##  [8,]  0.610  0.296 -0.055  0.328 -0.061
    ##  [9,] -0.005  0.004 -0.274  0.661  0.195
    ## [10,] -0.027 -0.125  0.361 -0.730 -0.026
    ## [11,] -0.265  0.026 -0.163 -0.719  0.032
    ## [12,]  0.035 -0.149 -0.198  0.596  0.136
    ## [13,]  0.340  0.084 -0.049  0.523 -0.029
    ## [14,]  0.013  0.014 -0.327  0.493  0.152
    ## [15,]  0.044 -0.328 -0.099 -0.371 -0.020
    ## [16,]  0.016  0.202  0.199  0.390  0.052
    ## [17,]  0.077 -0.306  0.010  0.632 -0.209
    ## [18,]  0.124 -0.023 -0.345 -0.648  0.024
    ## [19,] -0.013 -0.059  0.336  0.615 -0.096
    ## [20,]  0.187  0.017  0.422  0.372  0.053
    ## [21,]  0.055  0.008 -0.269 -0.416  0.477
    ## [22,] -0.113 -0.194  0.244  0.632  0.013
    ## [23,] -0.083 -0.247 -0.652  0.004 -0.129
    ## [24,]  0.019 -0.676 -0.004  0.106  0.035
    ## [25,]  0.318 -0.608 -0.025  0.018 -0.048
    ## [26,]  0.041 -0.385 -0.579 -0.071  0.149
    ## [27,] -0.007 -0.512  0.039  0.548  0.002
    ## [28,] -0.227 -0.267 -0.123  0.138  0.289
    ##
    ## $Phi
    ##        [,1]   [,2]   [,3]   [,4]   [,5]
    ## [1,]  1.000 -0.231 -0.128  0.105  0.317
    ## [2,] -0.231  1.000 -0.090 -0.143 -0.263
    ## [3,] -0.128 -0.090  1.000  0.295 -0.123
    ## [4,]  0.105 -0.143  0.295  1.000 -0.025
    ## [5,]  0.317 -0.263 -0.123 -0.025  1.000

    efaMRres$MultipleSolutions$Solutions[[2]]

    ## $Lambda
    ##         [,1]   [,2]   [,3]   [,4]   [,5]
    ##  [1,]  0.594 -0.042  0.129 -0.032  0.243
    ##  [2,]  0.451 -0.243  0.274  0.055  0.234
    ##  [3,]  0.337 -0.075 -0.053  0.196  0.332
    ##  [4,]  0.626  0.023 -0.389 -0.050  0.158
    ##  [5,]  0.363  0.104 -0.002  0.163  0.314
    ##  [6,]  0.186 -0.067 -0.070  0.057  0.382
    ##  [7,]  0.734 -0.005 -0.094  0.015 -0.240
    ##  [8,]  0.592  0.399  0.020 -0.006 -0.033
    ##  [9,] -0.022  0.409  0.064  0.475  0.104
    ## [10,] -0.031 -0.520 -0.026 -0.449  0.086
    ## [11,] -0.251 -0.219 -0.563 -0.256  0.007
    ## [12,]  0.021  0.239  0.125  0.504  0.074
    ## [13,]  0.329  0.308  0.199  0.216 -0.032
    ## [14,]  0.002  0.362 -0.088  0.419  0.061
    ## [15,]  0.048 -0.335 -0.298  0.120 -0.004
    ## [16,]  0.004  0.229  0.411 -0.072  0.066
    ## [17,]  0.096 -0.006  0.436  0.467 -0.221
    ## [18,]  0.127 -0.120 -0.772 -0.068  0.003
    ## [19,] -0.012  0.049  0.745  0.111 -0.059
    ## [20,]  0.162  0.024  0.628 -0.069  0.139
    ## [21,]  0.006  0.052 -0.625  0.030  0.450
    ## [22,] -0.118  0.011  0.666  0.275  0.024
    ## [23,] -0.049  0.046 -0.632  0.524 -0.262
    ## [24,]  0.013 -0.418  0.110  0.529  0.054
    ## [25,]  0.310 -0.386 -0.004  0.458  0.002
    ## [26,]  0.037 -0.036 -0.655  0.590  0.053
    ## [27,] -0.010 -0.156  0.412  0.582 -0.002
    ## [28,] -0.248 -0.044 -0.039  0.347  0.242
    ##
    ## $Phi
    ##        [,1]   [,2]   [,3]  [,4]   [,5]
    ## [1,]  1.000 -0.041  0.124 0.292  0.288
    ## [2,] -0.041  1.000  0.232 0.020 -0.226
    ## [3,]  0.124  0.232  1.000 0.343 -0.055
    ## [4,]  0.292  0.020  0.343 1.000  0.253
    ## [5,]  0.288 -0.226 -0.055 0.253  1.000

The output displays the multiple factoring loadings and factor correlations matrix for the unique solutions found. Also, the comparisons should the minimum congruence and raw congruences.

## Example 6

In Example 6, we illustrate how to align a factor loading matrix to an order matrix using the `Align.Matix` function. In addition, we align the factor correlation matrix accordingly. Let’s consider a 4-by-2 factor loading matrix. The order matrix, A, is also a 4-by-2 matrix. We form the 6-by-2 input matrix, B, by stacking the factor loading matrix and factor correlation matrix together. The first 4 rows contain the factor loading matrix and the last 2 rows contain the factor correlation matrix.

    #Order Matrix
    A <- matrix(c(0.8,0.6,0,0,0,0,0.8,0.7),nrow=4,ncol=2)
    #Input.Matrix
    B <-matrix(c(0,0,-0.8,-0.7,1,-0.2,0.8,0.7,0,0,-0.2,1),nrow=6,ncol=2)
    Align.Matrix(Order.Matrix=A, Input.Matrix=B)

    ##      [,1] [,2]
    ## [1,] 0.80  0.0
    ## [2,] 0.70  0.0
    ## [3,] 0.00  0.8
    ## [4,] 0.00  0.7
    ## [5,] 1.00  0.2
    ## [6,] 0.20  1.0
    ## [7,] 0.01  0.0

The output is a 7-by-2 matrix (p+m+1-by-m). The first p rows of the output matrix are factor loadings of the best match, the next m rows are factor correlations of the best match, and the last row contains information of the sums of squared deviations of the best match.

## References

Browne, M. W. (2001). An overview of analytic rotation in exploratory factor analysis. Multivariate Behavioral Research, 36, 111–150. : 10.1207/s15327906mbr3601_05

Browne, M. W., Cudeck, R., Tateneni, K., & Mels, G. (2010). CEFA 3.04: Comprehensive Exploratory Factor Analysis.

Cheung, F. M., Leung, K., Fan, R., Song, W., Zhang, J., & Zhang, J. (1996). Development of the Chinese Personality Assessment Inventory (CPAI). Journal of Cross-Cultural Psychology, 27, 181–199. : 10.1177/0022022196272003

Gorsuch, R. L. (1983). Factor analysis (2nd ed.). Mahwah, NJ: Lawrence Erlbaum Associates. : 10.4324/9780203781098

Hattori, M., Zhang, G., & Preacher, K. J. (2017). Multiple local solutions and geomin rotation. Multivariate Behavioral Research, 52, 720–731. : 10.1080/00273171.2017.1361312

John, O. P., Donahue, E. M., & Kentle, R. L. (1991). The Big Five Inventory – versions 4a and 54. Berkeley, CA: University of California, Berkeley, Institute of Personality and Social Research. : 10.1037/t07550-000

Luo, S. (2005). Personality and relationship satisfaction. (unpublished studies)

Luo, S., Chen, H., Yue, G., Zhang, G., Zhaoyang, R., & Xu, D. (2008). Predicting marital satisfaction from self, partner, and couple characteristics: Is it me, you, or us? Journal of Personality, 76, 1231–1266. : doi.org/10.1111/j.1467-6494.2008.00520.x

Resenzein, R. (1986). A structural equation analysis of Weiner’s attribution–affect model of helping behavior. Journal of Personality and Social Psychology,50, 1123–1133. :10.1037/0022-3514.50.6.1123

Zhang, G. (2014). Estimating standard errors in exploratory factor analysis. Multivariate Behavioral Research, 49, 339–353. : 10.1080/00273171.2014.908271

Zhang, G., Hattori, M., Trichtinger, L., & Wang, X. (2018). Target rotation with both factor loadings and factor correlations. Psychological Methods. : 10.1037/met0000198

Zhang, G., Hattori, M., Trichtinger, L (In press). Rotating factors to simplify their structural paths. Psychometrika. DOI: 10.1007/s11336-022-09877-3