Announcement

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

  • t-test output table by group

    Hi all,

    It may seem a silly question but I'm struggling to create a table with a t test like this one:

    First column Second column Third column Fourth column
    Variable A Mean first group Mean second group t statistics (with stars)
    Variable B Mean first group Mean second group t statistics (with stars)
    Variable C Mean first group Mean secondgroup t statistics (with stars)

    I tried with asdoc, installing also some packages but I didn't get good results
    I'm altro trying to exptrapolate as a word document.

    Would you be so kind to help me?
    Last edited by Marco Errico; 22 Jun 2020, 17:09.

  • #2
    Try using estpost ttest to generate the statistics and then esttab to create the output table.

    Code:
    sysuse auto
    
    estpost ttest price mpg headroom trunk, by(foreign)
    
    esttab, mtitle("diff") // gives the difference with the t-stat below  
    
    esttab , cell((mu_2(fmt(%12.2fc)) mu_1(fmt(%12.2fc)) t(fmt(%12.3fc) star) )) // seems close to what you are asking for
    Note that the way you define group will determine how you order the output.

    See the links for examples.

    Comment


    • #3
      Many thanks, Arthur.
      You're suggestion was really helpful

      Only one more thing. I don't know why if I write the title, it doesn't appear. It gives me the table with the title. Secondly, is there an options to display 3 decimal? Should I select it in the first row of your codes or in the last?

      Comment

      Working...
      X