Announcement

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

  • Export standard errors of SEM using estout

    Hi all.

    I am trying to make a table of the standardized factor loadings and their satorra bentler standard errors, using estout. I use these commands

    Code:
    sem (Factor1 -> x1, ) (Factor1-> x2, ) (Factor1 -> x3, ) (Factor1 -> x4, ) (Factor2 -> x5, ) (Factor2 -> x6, ) (Factor2 -> x7, ) (Factor2 -> x8, ) (Factor3 -> x9, ) (Factor3 -> x10, ) (Factor3 -> x11, ) (Factor3 -> x12, ) covstruct(_lexogenous, diagonal) vce(sbentler) standardized ///
    latent(Factor1 Factor2 Factor3 ) cov( Factor1*Factor2 Factor1*Factor3 Factor2*Factor3) nocapslatent 
    estimate store m1
    estout m1, cells(b_std(fmt(3) star) & se) stat(N) starlevels(* 0.10 ** 0.05 *** 0.01) drop(var* cov*)
    However, this does not give me the standard errors of the first item for each factor; meaning the item that due to standardization has a factor loadings other than 1.
    I have looked at r(table) and the standard errors are stored correctly in r(table). But I can't get them with estout.

    Thank you for taking the time,
    Emma

  • #2
    To increase your chances of obtaining timely and helpful replies, always include a data example illustrating your problem as per the FAQs. I will attempt to be explicit for the benefit of those who will follow this thread in the future. The default in sem is to report OIM standard errors.

    Code:
    . use http://www.stata-press.com/data/r15/sem_1fmm
    (single-factor measurement model)
    
    . sem (x1 x2 x3 x4 <- X), nolog
    
    Endogenous variables
    
    Measurement:  x1 x2 x3 x4
    
    Exogenous variables
    
    Latent:       X
    
    Structural equation model                       Number of obs     =        500
    Estimation method  = ml
    Log likelihood     = -8487.2337
    
     ( 1)  [x1]X = 1
    ------------------------------------------------------------------------------
                 |                 OIM
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    Measurement  |
      x1         |
               X |          1  (constrained)
           _cons |     99.518   .6412888   155.18   0.000      98.2611    100.7749
      -----------+----------------------------------------------------------------
      x2         |
               X |   1.033249   .0723898    14.27   0.000     .8913676     1.17513
           _cons |     99.954   .6341354   157.62   0.000     98.71112    101.1969
      -----------+----------------------------------------------------------------
      x3         |
               X |   1.063876   .0729725    14.58   0.000     .9208526      1.2069
           _cons |     99.052   .6372649   155.43   0.000     97.80298     100.301
      -----------+----------------------------------------------------------------
      x4         |
               X |   7.276754   .4277638    17.01   0.000     6.438353    8.115156
           _cons |     94.474   3.132547    30.16   0.000     88.33432    100.6137
    -------------+----------------------------------------------------------------
        var(e.x1)|   115.6865   7.790423                      101.3823    132.0089
        var(e.x2)|   105.0445    7.38755                      91.51873    120.5692
        var(e.x3)|   101.2572    7.17635                      88.12499    116.3463
        var(e.x4)|   144.0406   145.2887                      19.94838    1040.069
           var(X)|   89.93921   11.07933                      70.64676    114.5001
    ------------------------------------------------------------------------------
    LR test of model vs. saturated: chi2(2)   =      1.46, Prob > chi2 = 0.4827

    However, specifying the options vce(sbentler) standardized results in Satorra Bentler standard errors reported instead. The issue in #1 is that if you output results using estout or esttab (Stata Journal, by Ben Jann), you get the default OIM standard errors despite the fact that the results table displays Satorra Bentler standard errors. This is because estout or esttab will pick out whatever results are in e(V), whereas the displayed standard errors are stored in e(V_std).

    Code:
    sem (x1 x2 x3 x4 <- X), vce(sbentler) standardized
    ereturn list

    Results of ereturn list:

    Code:
    matrices:
                      e(b) :  1 x 13
                      e(V) :  13 x 13
                    e(Cns) :  1 x 14
               e(gradient) :  1 x 13
                  e(V_std) :  13 x 13
                  e(b_std) :  1 x 13
    Because e(V) and e(V_std) have the same dimensions, we can write a small program that replaces the entries in e(V) with those from e(V_std), and thereafter output the desired estimates.

    Code:
    use http://www.stata-press.com/data/r15/sem_1fmm
    sem (x1 x2 x3 x4 <- X), vce(sbentler) standardized
    *STORE THE DESIRED VCE MATRIX  
    mat V= e(V_std)
    *PROGRAM TO REPLACE ESTIMATES IN e(V)
    program replaceV, eclass
    ereturn repost V = V
    end
    *RUN PROGRAM
    replaceV
    *NOW OUTPUT ESTIMATES
    estout, cells(b_std(fmt(3) star) & se)


    Last edited by Andrew Musau; 13 Feb 2019, 15:08.

    Comment


    • #3
      Thank you very much Andrew.
      I have tried the program above but still got the OIM standard errors.

      Comment


      • #4
        Can you post the commands that you entered and the resulting Stata output? Note that you can define this program at most once during a given session.

        Code:
        *PROGRAM TO REPLACE ESTIMATES IN e(V)
        program replaceV, eclass
        ereturn repost V = V
        end
        *RUN PROGRAM
        replaceV
        Otherwise, you need to rename the program to, e.g., "replaceV2".

        Comment


        • #5
          I realized that my mistake was that I stored estimates with a name and then estout that specific name.

          Thank you very much to taking the time Andrew

          Best regards,
          Emma

          Comment

          Working...
          X