Skip to content

Notes on I‐GSCA Implementation

emstruong edited this page May 12, 2024 · 38 revisions

These are developer notes on how I-GSCA is implemented in the cSEM notes. It is intended to serve as both a refresher and reference to cSEM developers.

Implementation of cSEM::igsca()

Flow Chart

At a high level and omitting both (1) some mathematical details and (2) accessory steps to prepare data for computation:

flowchart TD
    A["`Prepare data using 
_cSEM::extract_parseModel()_`"]
    B["`Run igsca using 
_cSEM::igsca()_`"]
    C["`Prepare for ALS algorithm using 
_prepare_for_ALS()_`"] 
    D["`Alternating Least Squares Algorithm`"] 
    E["`Flip the signs of the **C**, **B** and **Gamma** using 
_flip_signs_ind_domi()_`"]
    Exit[(Exit)]
    A --> B --> C --> D --> E --> Exit
Loading
  • C stands for loadings matrix
  • B stands for structural-coefficients matrix
  • Gamma stands for ???

prepare_for_ALS()

flowchart TD
    init["`Provides initial estimates of W, C and B using **GSCA** as implemented in
_gsca_inione()_`"]
    init2["`Initialize:
(1) **V**
(2) **Z** as standardized indicators matrix
(3) **Gamma** as matrix multiplication of **Z** and **W**
(4) **Du** through SVD`"]
    Exit[(Exit)]
    init --> init2 --> Exit
Loading
  • DU corresponds to the uniqueness terms. (U is capitalized because lower-case u corresponds to SVD output and not the error/uniqueness terms we are interested in.)

Alternating Least Squares Algorithm

  • Weights are done in one function
  • Loadings are done in a for loop sequentially for each construct variable
flowchart TD

    ChangeEps["`Evaluate if both are true:
(1) The sum of the absolute changes in the parameter estimates is more than _ceps_
(2) If the number of elapsed iterations is less than or equal to _itmax_`"]
    Weights["`Update Weights using 
_update_X_weights()_`"]
    Loadings1["`Update c of each construct variable in a _for_ loop using either:
(A) update_composite_LV()
(B) update_factor_LV()`"] 
    Loadings2["`Update C, B, D, uniqueD, list of parameter estimates and U using
_update_C_B_D()_`"]
    Exit[(Exit)]


    Start --> ChangeEps -->|TRUE|Weights --> Loadings1 --> Loadings2 -->  
    ChangeEps -->|FALSE|Exit
Loading
  • c is a vector of C and is the loadings of each construct variable onto its indicators

  • D is the matrix of error terms associated with each latent variable onto its indicators (Technically Du is.)

  • V ? I'm pretty sure these are temporary variables

  • Gamma ?

  • theta ?

  • Xj ?

Comparisons with Other Implementations

The implementation of IGSCA in cSEM was compared against GSCAPro Version 1.2.1 and a Matlab version kindly sent by Dr. Heungsun Hwang.

GSCAPro V1.2.1

The .csv files for the output of GSCAPro are stored in tests/comparisons/igsca_translation/GSCAPro_1_2_1Output.

These .csv files were formatted for comparison using cSEM::get_lavaan_table_igsca_gscapro()

The .RData for comparing between GSCAPro and csem::igsca() are found in tests/data/igsca_gscapro.RData/

Matlab: igsca_sim_test.m

igsca_sim_test.m is a modified version of the original igsca_sim.m sent by Dr. Hwang. The modifications were made to facilitate the repeated execution of the exemplary model.

The .csv files for the input to igsca_sim.m are stored in tests/comparisons/igsca_translation/matlab_in.

The output of igsca_sim.m was transformed into a table of results (probably-THIS NEEDS TO BE DOUBLE CHECKED) through cSEM::get_lavaan_table_igsca_matrix()

The .RData for comparing between GSCAPro and csem::igsca() are found in tests/data/igsca_matlab.RData/

Terminological Differences

Here, we adopt the terminology that:

  • Latent variables, common factors, factors, latent common factors are all the same concept
  • Component variables, composite variables, weighted sum scores are all the same concept
  • Latent and component variables are sub-sets of the more general class of construct variables.

Clone this wiki locally