Announcement

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

  • Any commands to make reproducible research easier for logistic regression?

    Hi, I am a public health researcher.

    Most of the time, I use binary outcomes (Y/N) which leads me to conduct logistic regression.

    Every time I create a publishable table, I have to copy-paste the regression output table which is time-consuming and error-prone.

    Is there any stata commands that I can use to make this process easier?

    I've tried 'outreg2' and 'regsave' but these seem to work with linear regression but not logistic regression. I've also tried putexcel/putdocx, but these require too many codes that clutter my do-file. I am looking for more one or two-line codes.


    Any recommends are welcome!!

    Thanks!



  • #2
    You might try Dr. Attaullah Shah's -asdoc- (ssc desc asdoc) and outreg2 works fine with logistic regression. Note, with -putdocx- you can place images, textblocks, and other options that give more control over the document.

    Code:
    sysuse auto
    
    putdocx begin, font("New Times Roman")
    logit fore price mpg
    putdocx table  foreign =etable
    putdocx save mytable, replace
    
    asdoc logit foreign price mpg, save(mytable2.doc) replace
    
    logit fore price mpg
    outreg2 using myable3.doc, replace

    Comment


    • #3
      Welcome to Statalist.

      The estout community-contributed Stata command may prove useful.

      But with that said, the output of help outreg2 tells us

      outreg2 can report any regression output, provided it conforms to the usual convention for ereturn list. This includes most regression commands in Stata 7 or later.
      And example 10 of that output specifically presents its use following logistic regression. The outreg2 community-contributed software was last updated in 2014, however,.

      Ben Jann has updated estout as recently as 31 May 2019 (as I write this in August 2019) and is a frequent contributor to Statalist. My choice would be to go with an actively supported package.

      Comment


      • #4
        If all you need is a nicer looking table, commands like those already mentioned should be fine. But if you have to produce similar reports on a regular basis. you may wish to check out Stata 16's reproducible reporting commands.

        https://www.stata.com/new-in-stata/t...ble-reporting/
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          Thank you all for your recommendations!

          Comment


          • #6
            MinKyung Kim -regsave- will work fine with logistic regression. For example:

            Code:
            sysuse auto, clear
            logit foreign price
            
            * Option 1
            regsave
            list
            
            * Option 2
            regsave, table(my_table, parentheses(stderr))
            replace var = "" if strpos(var,"_stderr")
            list
            You can then outsheet the dataset to Excel or use a program like -texsave- to produce a LaTeX version.
            Associate Professor of Finance and Economics
            University of Illinois
            www.julianreif.com

            Comment

            Working...
            X