Announcement

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

  • Export to csv indirect effects results of SEM model

    I am building and estimating SEM model and exporting results to csv files for further use.

    #Model:
    sem (F1 -> Ally, ) (F1 -> log_VC, ) (Ally -> log_VC, ) (num_found -> Ally, ) (num_found -> log_VC, ) (Stage -> Ally, ) (Stage -> log_VC, ) (log_size -> Ally, ) (log_size -> log_VC, ) (rev -> Ally, ) (rev -> log_VC, ) (CI_Avg -> Ally, ) (CI_Avg -> log_VC, ) (Sec_A -> Ally, ) (Sec_A -> log_VC, ) (Sec_B -> Ally, ) (Sec_B -> log_VC, ) (Sec_C -> Ally, ) (Sec_C -> log_VC, ) (Birth -> Ally, ) (Birth -> log_VC, ) (Maturity -> Ally, ) (Maturity -> log_VC, ), nocapslatent

    #Testing direct and indirect effects:
    estat teffects

    #Export results to csv file
    esttab using "C:\Users\*****\001.csv", replace drop(_cons) noobs nostar nonotes p wide plain

    # It exports total results to csv file. But I need also that indirect effects results would also be exported to csv file. I tried different variations, but failed.
    # Please help

  • #2
    Can you provide a reproducible example and use the appropriate text delimiters in your post to make it easier for others to replicate and try to help solve your issue?

    Comment


    • #3
      -estat teffects- stores background matrices (see -ereturn list- after running -estat teffects-) that you can manipulate and export. There are lots of approaches here (and you dont give any details on the model you're running or desired formatting/structure of the output) so here's a really quick example for a simple export of indirect effects to excel:

      Code:
      sysuse auto, clear
      
      sem (price<-mpg) (mpg<-turn trunk) (price<-turn trunk) , standardized
      estat teffects,   coeflegend //here's is a key or legend showing how you can get access each effect in the output
      estat teffects,   standardized  //I'll assume you want the std versions of these
      return li  //here are all the things you can export to excel after estat teffects
      ereturn li //and here
      mat li e(b_std)
      matrix I =r(indirect_std)
      mat li I
      
      putexcel set results.xls, replace
      putexcel A1 = matrix(I) //you'll have to make any transformations before exporting, or export one cell at a time and put it where you'd like.
      putexcel close
      Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

      Comment


      • #4
        asdocx offers a convenient way to export the table of total, direct, and indirect effects to MS Word, Excel, LaTeX, or HTML. asdocx compiles various statistics from the stored matrices and creates a complete table of coefficient, standard errors, z-statistics, and p-values. Here is one example (More examples and details of the options are discussed on this page https://fintechprofessor.com/asdocx/...l-latex-stata/ )
        Code:
        * Load another dataset
        use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear
        
        sem (read <- write math ses socst ) ///
            (science <- read math awards ) ///
            (write <- math read awards )
        
        asdocx estat teffects, effects(te de ie) tzok replace
        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	58.1 KB
ID:	1668326


        Two more tables produced (total effects and direct effects). However, they are not reported here. The above example does not follow any theory for model building. It just shows the use of asdocx with estat teffects.

        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment

        Working...
        X