Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Where STATA is storing the loading factors ( Factor analysis using GSEM)

    Hi guys,

    I used "gsem" commend and "predict, latent" to estimate factor scores and the factors scores were created and saved in the dataset directly. Does anyone know where stata is storing the loaing factors?
    I want to double check if we can get the same F1 by using these 2 methods:
    1). the linear combination using loading factors F1 = a0 + a1*X1 + a2*X2 + a3*X3 ( dont know how to find the loading factors)
    2) the predict statement from gsem.

    Thanks!
    Last edited by Dan Su; 03 Dec 2018, 13:59. Reason: stata

  • #2

    Please look at the toy example below:

    Code:
    . use http://www.stata-press.com/data/r15/sem_2fmm
    (Affective and cognitive arousal)
    
    . sem (Affective -> a1 a2 a3 a4 a5) (Cognitive -> c1 c2 c3 c4 c5)
    
    Endogenous variables
    
    Measurement:  a1 a2 a3 a4 a5 c1 c2 c3 c4 c5
    
    Exogenous variables
    
    Latent:       Affective Cognitive
    
    Fitting target model:
    
    Iteration 0:   log likelihood = -9542.8803  
    Iteration 1:   log likelihood = -9539.5505  
    Iteration 2:   log likelihood = -9539.3856  
    Iteration 3:   log likelihood = -9539.3851  
    
    Structural equation model                       Number of obs     =        216
    Estimation method  = ml
    Log likelihood     = -9539.3851
    
     ( 1)  [a1]Affective = 1
     ( 2)  [c1]Cognitive = 1
    -----------------------------------------------------------------------------------------
                            |                 OIM
                            |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ------------------------+----------------------------------------------------------------
    Measurement             |
      a1                    |
                  Affective |          1  (constrained)
      ----------------------+----------------------------------------------------------------
      a2                    |
                  Affective |   .9758098   .0460752    21.18   0.000      .885504    1.066116
      ----------------------+----------------------------------------------------------------
      a3                    |
                  Affective |   .8372599   .0355086    23.58   0.000     .7676643    .9068556
      ----------------------+----------------------------------------------------------------
      a4                    |
                  Affective |   .9640461   .0499203    19.31   0.000      .866204    1.061888
      ----------------------+----------------------------------------------------------------
      a5                    |
                  Affective |   1.063701   .0435751    24.41   0.000     .9782951    1.149107
      ----------------------+----------------------------------------------------------------
      c1                    |
                  Cognitive |          1  (constrained)
      ----------------------+----------------------------------------------------------------
      c2                    |
                  Cognitive |   1.114702   .0655687    17.00   0.000     .9861901    1.243215
      ----------------------+----------------------------------------------------------------
      c3                    |
                  Cognitive |   1.329882   .0791968    16.79   0.000     1.174659    1.485105
      ----------------------+----------------------------------------------------------------
      c4                    |
                  Cognitive |   1.172792   .0711692    16.48   0.000     1.033303    1.312281
      ----------------------+----------------------------------------------------------------
      c5                    |
                  Cognitive |   1.126356   .0644475    17.48   0.000     1.000041    1.252671
    ------------------------+----------------------------------------------------------------
                   var(e.a1)|   384.1359   43.79119                      307.2194    480.3095
                   var(e.a2)|   357.3524   41.00499                      285.3805    447.4755
                   var(e.a3)|   154.9507   20.09026                      120.1795    199.7822
                   var(e.a4)|   496.4594   54.16323                      400.8838    614.8214
                   var(e.a5)|   191.6857   28.07212                      143.8574    255.4154
                   var(e.c1)|   171.6638   19.82327                       136.894    215.2649
                   var(e.c2)|   171.8055   20.53479                      135.9247    217.1579
                   var(e.c3)|   276.0144   32.33535                      219.3879    347.2569
                   var(e.c4)|   224.1994   25.93412                      178.7197    281.2527
                   var(e.c5)|   146.8655    18.5756                      114.6198    188.1829
              var(Affective)|   1644.463   193.1032                      1306.383    2070.034
              var(Cognitive)|   455.9349   59.11245                      353.6255    587.8439
    ------------------------+----------------------------------------------------------------
    cov(Affective,Cognitive)|   702.0736   85.72272     8.19   0.000     534.0601     870.087
    -----------------------------------------------------------------------------------------
    LR test of model vs. saturated: chi2(34)  =     88.88, Prob > chi2 = 0.0000
    
    . matrix list e(b)
    
    e(b)[1,23]
                   a1:            a2:            a3:            a4:            a5:            c1:
                                                                                                 
            Affective      Affective      Affective      Affective      Affective      Cognitive
    y1              1      .97580977      .83725991      .96404607      1.0637008              1
    
                   c2:            c3:            c4:            c5:             /:             /:
                                                                                                 
            Cognitive      Cognitive      Cognitive      Cognitive      var(e.a1)      var(e.a2)
    y1      1.1147024      1.3298818       1.172792      1.1263562       384.1359      357.35245
    
                    /:             /:             /:             /:             /:             /:
                                                                                                 
            var(e.a3)      var(e.a4)      var(e.a5)      var(e.c1)      var(e.c2)      var(e.c3)
    y1      154.95073      496.45944      191.68568      171.66381      171.80551      276.01442
    
                    /:             /:             /:             /:             /:
                                                                    cov(Affect~e,
            var(e.c4)      var(e.c5)  var(Affect~e)  var(Cognit~e)     Cognitive)
    y1      224.19942      146.86551      1644.4625      455.93486      702.07357
    
    .
    Hopefully that helps.
    Best regards,

    Marcos

    Comment


    • #3
      Originally posted by Marcos Almeida View Post
      Please look at the toy example below:

      Code:
      . use http://www.stata-press.com/data/r15/sem_2fmm
      (Affective and cognitive arousal)
      
      . sem (Affective -> a1 a2 a3 a4 a5) (Cognitive -> c1 c2 c3 c4 c5)
      
      Endogenous variables
      
      Measurement: a1 a2 a3 a4 a5 c1 c2 c3 c4 c5
      
      Exogenous variables
      
      Latent: Affective Cognitive
      
      Fitting target model:
      
      Iteration 0: log likelihood = -9542.8803
      Iteration 1: log likelihood = -9539.5505
      Iteration 2: log likelihood = -9539.3856
      Iteration 3: log likelihood = -9539.3851
      
      Structural equation model Number of obs = 216
      Estimation method = ml
      Log likelihood = -9539.3851
      
      ( 1) [a1]Affective = 1
      ( 2) [c1]Cognitive = 1
      -----------------------------------------------------------------------------------------
      | OIM
      | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      ------------------------+----------------------------------------------------------------
      Measurement |
      a1 |
      Affective | 1 (constrained)
      ----------------------+----------------------------------------------------------------
      a2 |
      Affective | .9758098 .0460752 21.18 0.000 .885504 1.066116
      ----------------------+----------------------------------------------------------------
      a3 |
      Affective | .8372599 .0355086 23.58 0.000 .7676643 .9068556
      ----------------------+----------------------------------------------------------------
      a4 |
      Affective | .9640461 .0499203 19.31 0.000 .866204 1.061888
      ----------------------+----------------------------------------------------------------
      a5 |
      Affective | 1.063701 .0435751 24.41 0.000 .9782951 1.149107
      ----------------------+----------------------------------------------------------------
      c1 |
      Cognitive | 1 (constrained)
      ----------------------+----------------------------------------------------------------
      c2 |
      Cognitive | 1.114702 .0655687 17.00 0.000 .9861901 1.243215
      ----------------------+----------------------------------------------------------------
      c3 |
      Cognitive | 1.329882 .0791968 16.79 0.000 1.174659 1.485105
      ----------------------+----------------------------------------------------------------
      c4 |
      Cognitive | 1.172792 .0711692 16.48 0.000 1.033303 1.312281
      ----------------------+----------------------------------------------------------------
      c5 |
      Cognitive | 1.126356 .0644475 17.48 0.000 1.000041 1.252671
      ------------------------+----------------------------------------------------------------
      var(e.a1)| 384.1359 43.79119 307.2194 480.3095
      var(e.a2)| 357.3524 41.00499 285.3805 447.4755
      var(e.a3)| 154.9507 20.09026 120.1795 199.7822
      var(e.a4)| 496.4594 54.16323 400.8838 614.8214
      var(e.a5)| 191.6857 28.07212 143.8574 255.4154
      var(e.c1)| 171.6638 19.82327 136.894 215.2649
      var(e.c2)| 171.8055 20.53479 135.9247 217.1579
      var(e.c3)| 276.0144 32.33535 219.3879 347.2569
      var(e.c4)| 224.1994 25.93412 178.7197 281.2527
      var(e.c5)| 146.8655 18.5756 114.6198 188.1829
      var(Affective)| 1644.463 193.1032 1306.383 2070.034
      var(Cognitive)| 455.9349 59.11245 353.6255 587.8439
      ------------------------+----------------------------------------------------------------
      cov(Affective,Cognitive)| 702.0736 85.72272 8.19 0.000 534.0601 870.087
      -----------------------------------------------------------------------------------------
      LR test of model vs. saturated: chi2(34) = 88.88, Prob > chi2 = 0.0000
      
      . matrix list e(b)
      
      e(b)[1,23]
      a1: a2: a3: a4: a5: c1:
      
      Affective Affective Affective Affective Affective Cognitive
      y1 1 .97580977 .83725991 .96404607 1.0637008 1
      
      c2: c3: c4: c5: /: /:
      
      Cognitive Cognitive Cognitive Cognitive var(e.a1) var(e.a2)
      y1 1.1147024 1.3298818 1.172792 1.1263562 384.1359 357.35245
      
      /: /: /: /: /: /:
      
      var(e.a3) var(e.a4) var(e.a5) var(e.c1) var(e.c2) var(e.c3)
      y1 154.95073 496.45944 191.68568 171.66381 171.80551 276.01442
      
      /: /: /: /: /:
      cov(Affect~e,
      var(e.c4) var(e.c5) var(Affect~e) var(Cognit~e) Cognitive)
      y1 224.19942 146.86551 1644.4625 455.93486 702.07357
      
      .
      Hopefully that helps.
      Thank you so much Marcos!!

      Comment


      • #4
        Thank you for informing the reply suits you well.
        Best regards,

        Marcos

        Comment

        Working...
        X