Announcement

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

  • Nice t-test output tables

    Hi guys,

    I would like to get the results for my t-test as a nice word-file output. What's the best way to do that?
    These outreg2 and esttab commands are not working properly. I'm only getting empty pages or empty tables.


    Any advice is appreciated

  • #2
    you might want to look at part 4 of Chuck Huber's 7 part blog series on the version 17 -table- command: https://blog.stata.com/2021/08/24/cu...istical-tests/

    Comment


    • #3
      You may find the community contributed asdoc command helpful. Use the following Stata commands to install it and review the documentation.
      Code:
      net install asdoc, from(http://fintechprofessor.com)
      help asdoc

      Comment


      • #4
        Originally posted by William Lisowski View Post
        You may find the community contributed asdoc command helpful. Use the following Stata commands to install it and review the documentation.
        Code:
        net install asdoc, from(http://fintechprofessor.com)
        help asdoc
        Thanks,
        I tried it, but unfortunately it also doesn't work well. I'm getting several different errors.
        While using the provided data, the specific command works but my word-file again is empty, there is just a headline.
        And when I try the same command with my data, it doesn't even work.

        Comment


        • #5
          With no example of the code you ran and the errors Stata reported in the Results window, it's impossible to tell you how to change your code.

          It works for me. This is based on the first example from the documentation.
          Code:
          clear all
          cls
          sysuse auto, clear
          asdoc ttest rep78==0, title(T-test results : mean == 0)  save(~/Downloads/report.doc) replace
          asdoc ttest price==0, rowappend save(~/Downloads/report.doc) append
          asdoc ttest mpg==0, rowappend save(~/Downloads/report.doc) append
          asdoc ttest turn==0, rowappend save(~/Downloads/report.doc) append
          asdoc ttest weight==0, rowappend save(~/Downloads/report.doc) append
          Code:
          . sysuse auto, clear
          (1978 automobile data)
          
          . asdoc ttest rep78==0, title(T-test results : mean == 0)  save(~/Downloads/report.doc) replace
          
                              T-test results : mean == 0
          
          -------------------------------------------------------------------------
                           |       obs       Mean     St_Err    t_value    p_value
          -----------------+-------------------------------------------------------
                     rep78 |        69      3.406       .119    28.5785          0
          -------------------------------------------------------------------------
          (file ~/Downloads/report.doc not found)
            0.119
          Click to Open File:  ~/Downloads/report.doc
          
          . asdoc ttest price==0, rowappend save(~/Downloads/report.doc) append
          
                              One-sample t test for price
          
          -------------------------------------------------------------------------
                           |       obs       Mean     St_Err    t_value    p_value
          -----------------+-------------------------------------------------------
                     price |        74   6165.257    342.872     17.981          0
          -------------------------------------------------------------------------
            342.872
          Click to Open File:  ~/Downloads/report.doc
          
          . asdoc ttest mpg==0, rowappend save(~/Downloads/report.doc) append
          
                              One-sample t test for mpg
          
          -------------------------------------------------------------------------
                           |       obs       Mean     St_Err    t_value    p_value
          -----------------+-------------------------------------------------------
                       mpg |        74    21.2975      .6725    31.6665          0
          -------------------------------------------------------------------------
            0.672
          Click to Open File:  ~/Downloads/report.doc
          
          . asdoc ttest turn==0, rowappend save(~/Downloads/report.doc) append
          
                              One-sample t test for turn
          
          -------------------------------------------------------------------------
                           |       obs       Mean     St_Err    t_value    p_value
          -----------------+-------------------------------------------------------
                      turn |        74    39.6485      .5115    77.5275          0
          -------------------------------------------------------------------------
            0.512
          Click to Open File:  ~/Downloads/report.doc
          
          . asdoc ttest weight==0, rowappend save(~/Downloads/report.doc) append
          
                              One-sample t test for weight
          
          -------------------------------------------------------------------------
                           |       obs       Mean     St_Err    t_value    p_value
          -----------------+-------------------------------------------------------
                    weight |        74   3019.459     90.347    33.4205          0
          -------------------------------------------------------------------------
            90.347
          Click to Open File:  ~/Downloads/report.doc
          
          .
          Click image for larger version

Name:	image_28480.png
Views:	1
Size:	47.8 KB
ID:	1680740

          Last edited by William Lisowski; 04 Sep 2022, 19:48.

          Comment


          • #6
            You're right, sorry.
            But what I mean is rather somethign like this here.


            Click image for larger version

Name:	ttest.JPG
Views:	1
Size:	30.3 KB
ID:	1680803



            I'm getting closer to it with the esttab command but I'm not yet where I want to be.

            Comment


            • #7
              What you are asking for is comprehensively covered in the table1 template of asdocx. See this post for details https://fintechprofessor.com/asdocx/...tients-asdocx/
              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


              • #8
                take a look at part 4 of Chuck Huber's series of blogs on the -table- command: https://blog.stata.com/2021/08/24/cu...istical-tests/

                Comment

                Working...
                X