Announcement

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

  • Exporting stata tables for academic paper

    Hi, I am currently working with the community created -estout- and -asdoc- commands to put multiple regressions into one table.

    This is the code I am currently using
    Code:
    *Data regressions
    reg lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
    estimates store m1 , title(Model 1)
    reg F1.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
    estimates store m2 , title(Model 2)
    reg F2.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
    estimates store m3 , title(Model 3)
    reg F3.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
    estimates store m4, title(Model 4)
    reg F4.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
    estimates store m5, title(Model 5)
    reg F5.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
    estimates store m6, title(Model 6)
    asdoc estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(6)) se(par fmt(6)))
    My first issue is, I want to include the adjusted r-squared parameters and the number of observations but I cannot find the code for this. Additionally using asdoc makes the table very unaligned- is there a way around this instead of manually formatting?

  • #2
    Try using the new Stata 17 table commands. Here's some code to get you started:

    Code:
    clear
    sysuse auto
    reg price mpg trunk
    estimates store m1, title(Model 1)
    reg mpg weight length
    estimates store m2, title(Model 2)
    etable, estimates(m1 m2) showstars  mstat(r2_a)  column(estimates) export(doc1.docx)
    Last edited by Devra Golbe; 16 Mar 2023, 15:46.
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

    Comment


    • #3
      Hi Devra, how was the etable command installed? Using ssc install etable?

      Comment


      • #4
        etable was added to Stata 17 on 17 November 2021.

        If you can't see it your Stata is not up-to-date as from that date, but even if so

        https://www.stata.com/help.cgi?whatsnew

        gives the explanation. etable is an official command and not downloadable from SSC.

        Comment


        • #5
          Thanks Nick I have got it to work. I am having a few issues with the format of the table- is there a reason why they are not aligned, and also is there a way to increase the decimal points it goes up to?

          Code:
          reg lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
          estimates store m1 , title(Model 1)
          reg F1.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
          estimates store m2 , title(Model 2)
          reg F2.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
          estimates store m3 , title(Model 3)
          reg F3.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
          estimates store m4, title(Model 4)
          reg F4.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
          estimates store m5, title(Model 5)
          reg F5.lretFTSE100 UKIS ldiffEPU ldiffGDP ldiffprodindex ldiffjobclaim lCCI lretFTSE100 L1.lretFTSE100 L2.lretFTSE100 L3.lretFTSE100 L4.lretFTSE100 L5.lretFTSE100
          estimates store m6, title(Model 6)
          etable, estimates(m1 m2 m3 m4 m5 m6) showstars  mstat(r2_a) mstat(N)  column(estimates) export(doc1.docx)
          Code:
                                   m1         m2         m3         m4         m5         m6    
          ----------------------------------------------------------------------------------------
          UKIS-0.1                -0.000                                                          
                                 (0.002)                                                          
          ldiffEPU                -0.000                                                          
                                 (0.000)                                                          
          ldiffGDP                 0.055                                                          
                                 (0.042)                                                          
          ldiffprodindex          -0.000                                                          
                                 (0.010)                                                          
          ldiffprodindex           0.006                                                          
                                 (0.004)                                                          
          lCCI                     0.076                                                          
                                 (0.045)                                                          
          L.lretFTSE100           -0.038 **                                                       
                                 (0.015)                                                          
          L2.lretFTSE100          -0.041 **                                                       
                                 (0.015)                                                          
          L3.lretFTSE100          -0.035 *                                                        
                                 (0.015)                                                          
          L4.lretFTSE100           0.030 *                                                        
                                 (0.015)                                                          
          L5.lretFTSE100          -0.029                                                          
                                 (0.015)                                                          
          Intercept                0.000                                                          
                                 (0.000)                                                          
          UKIS-0.1                           -0.002                                               
                                            (0.002)                                               
          ldiffEPU                            0.000                                               
                                            (0.000)                                               
          ldiffGDP                            0.079                                               
                                            (0.042)                                               
          ldiffprodindex                      0.003                                               
                                            (0.010)                                               
          ldiffprodindex                      0.004                                               
                                            (0.004)                                               
          lCCI                                0.075                                               
                                            (0.045)                                               
          L.lretFTSE100                      -0.040 **                                            
                                            (0.015)                                               
          L2.lretFTSE100                     -0.037 *                                             
                                            (0.015)                                               
          L3.lretFTSE100                      0.029                                               
                                            (0.015)                                               
          L4.lretFTSE100                     -0.030 *                                             
                                            (0.015)                                               
          L5.lretFTSE100                     -0.047 **                                            
                                            (0.015)                                               
          lretFTSE100                        -0.040 **                                            
                                            (0.015)                                               
          Intercept                           0.000                                               
                                            (0.000)                                               
          UKIS-0.1                                       0.003                                    
                                                       (0.002)                                    
          ldiffEPU                                      -0.000                                    
                                                       (0.000)                                    
          ldiffGDP                                       0.069                                    
                                                       (0.042)                                    
          ldiffprodindex                                 0.008                                    
                                                       (0.010)                                    
          ldiffprodindex                                 0.006                                    
                                                       (0.004)                                    
          lCCI                                           0.077                                    
                                                       (0.045)                                    
          L.lretFTSE100                                 -0.036 *                                  
                                                       (0.015)                                    
          L2.lretFTSE100                                 0.031 *                                  
                                                       (0.015)                                    
          L3.lretFTSE100                                -0.031 *                                  
                                                       (0.015)                                    
          L4.lretFTSE100                                -0.044 **                                 
                                                       (0.015)                                    
          L5.lretFTSE100                                 0.041 **                                 
                                                       (0.015)                                    
          lretFTSE100                                   -0.038 *                                  
                                                       (0.015)                                    
          Intercept                                      0.000                                    
                                                       (0.000)

          Comment


          • #6
            Sorry, but I have never used etable and can't illuminate your problem.

            Comment


            • #7
              I'm by no means an expert on these commands. Not sure why etable doesn't stack these side-by-side-- maybe it's because the dependent variables differ. You can try the full table command instead. I learned most of what I know about these commands from Chuck Huber's excellent series of blog posts. Part 6 is devoted to regression tables. The code below should get you started.

              [CODE
              clear
              sysuse auto

              collect clear
              collect create MyModels
              collect _r_b _r_se , name(MyModels) tag(Model[ Model 1]): reg price mpg trunk
              collect _r_b _r_se , name(MyModels) tag(Model[Model 2]): reg length mpg trunk
              collect layout (colname#result result[r2_a]) (Model), name(MyModels)
              [/CODE]
              Devra Golbe
              Professor Emerita, Dept. of Economics
              Hunter College, CUNY

              Comment


              • #8
                Thank you Devra. Just on the topic of the etable command, do you know how I would specify values to more decimal points?

                Comment


                • #9
                  Stata's help files and manuals are excellent. You'll find the formatting options there. See, in particular, nformat(%fmt). If you've solved the alignment problem it would be helpful to others (me, for instance) to post the solution here.
                  Last edited by Devra Golbe; 20 Mar 2023, 10:27.
                  Devra Golbe
                  Professor Emerita, Dept. of Economics
                  Hunter College, CUNY

                  Comment

                  Working...
                  X