Announcement

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

  • how to output the beta, t statistics and p values in one table simultaneously?

    how to output the beta, t statistics and p values in one table simultaneously?
    Like this:
    Click image for larger version

Name:	1.png
Views:	1
Size:	385.3 KB
ID:	1658860

  • #2
    Code:
    ssc install estout, replace
    Code:
    sysuse auto
    eststo m1: regress mpg weight disp
    eststo m2: regress mpg weight disp turn
    esttab m1 m2, cells("b(fmt(3)) p(fmt(3))" se(fmt(3) par)) ///
    collab("Coef. (SE)" "p-value", lhs("Variables")) ///
     nonumbers mlab("Model 1" "Model 2") label
    Res.:

    Code:
    . esttab m1 m2, cells("b(fmt(3)) p(fmt(3))" se(fmt(3) par)) ///
    > collab("Coef. (SE)" "p-value", lhs("Variables")) ///
    >  nonumbers mlab("Model 1" "Model 2") label
    
    ------------------------------------------------------------------------
                              Model 1                   Model 2             
    Variables              Coef. (SE)      p-value   Coef. (SE)      p-value
    ------------------------------------------------------------------------
    Weight (lbs.)              -0.007        0.000       -0.006        0.000
                              (0.001)                   (0.001)             
    Displacement .. in.)        0.005        0.594        0.006        0.574
                              (0.010)                   (0.010)             
    Turn Circle (ft.)                                    -0.139        0.442
                                                        (0.179)             
    Constant                   40.085        0.000       43.588        0.000
                              (2.020)                   (4.964)             
    ------------------------------------------------------------------------
    Observations                   74                        74             
    ------------------------------------------------------------------------

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      Code:
      ssc install estout, replace
      Code:
      sysuse auto
      eststo m1: regress mpg weight disp
      eststo m2: regress mpg weight disp turn
      esttab m1 m2, cells("b(fmt(3)) p(fmt(3))" se(fmt(3) par)) ///
      collab("Coef. (SE)" "p-value", lhs("Variables")) ///
      nonumbers mlab("Model 1" "Model 2") label
      Res.:

      Code:
      . esttab m1 m2, cells("b(fmt(3)) p(fmt(3))" se(fmt(3) par)) ///
      > collab("Coef. (SE)" "p-value", lhs("Variables")) ///
      > nonumbers mlab("Model 1" "Model 2") label
      
      ------------------------------------------------------------------------
      Model 1 Model 2
      Variables Coef. (SE) p-value Coef. (SE) p-value
      ------------------------------------------------------------------------
      Weight (lbs.) -0.007 0.000 -0.006 0.000
      (0.001) (0.001)
      Displacement .. in.) 0.005 0.594 0.006 0.574
      (0.010) (0.010)
      Turn Circle (ft.) -0.139 0.442
      (0.179)
      Constant 40.085 0.000 43.588 0.000
      (2.020) (4.964)
      ------------------------------------------------------------------------
      Observations 74 74
      ------------------------------------------------------------------------
      Wow, this is amazing! Thanks so much!

      Comment


      • #4
        @Andrew Musau Can we automatically set this?
        Can we set the rtf file to landscape view?
        Click image for larger version

Name:	1.png
Views:	1
Size:	41.3 KB
ID:	1658884

        Comment


        • #5
          There is no such option in estout, but you got a workaround in this recent thread: https://www.statalist.org/forums/for...landscape-view

          Comment


          • #6
            Originally posted by Andrew Musau View Post
            There is no such option in estout, but you got a workaround in this recent thread: https://www.statalist.org/forums/for...landscape-view
            Thanks Andrew, in that way, I need to set the prehead option after each esttab, it is a little redundant.

            Comment


            • #7
              You could ask Ben Jann to add such an option to estout.

              Comment


              • #8
                Originally posted by Andrew Musau View Post
                Code:
                ssc install estout, replace
                ------------------------------------------------------------------------
                Observations 74 74
                ------------------------------------------------------------------------


                [/CODE]
                when we use label option, can we replace the Onservations to N?

                Comment


                • #9
                  Code:
                  esttab, label stats(N)

                  Comment


                  • #10
                    Originally posted by Andrew Musau View Post
                    Code:
                    esttab, label stats(N)
                    Hi Andrew, if I set
                    Code:
                    stats(N)
                    can I set the N to be italic? Thanks!

                    Comment


                    • #11
                      In SMCL:

                      Code:
                      sysuse auto, clear
                      reg mpg weight, nocons
                      esttab, label stats(N, label({it}N))
                      Res.:

                      Code:
                      . esttab, label stats(N, label({it}N))
                      
                      ------------------------------------
                                                    (1)  
                                           Mileage (m~)  
                      ------------------------------------
                      Weight (lbs.)             0.00625***
                                                (16.10)  
                      ------------------------------------
                      N                          74  
                      ------------------------------------
                      t statistics in parentheses
                      * p<0.05, ** p<0.01, *** p<0.001

                      Not sure if this exports to other formats. In LaTeX, you specify this as "\emph{N}", not sure what is the equivalent in -rtf- format. Just Google it.

                      Comment


                      • #12
                        Thank you!

                        Comment


                        • #13
                          Actually, this is covered in http://repec.org/bocode/e/estout/esttab.html

                          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	106.2 KB
ID:	1659190

                          Comment


                          • #14
                            This works, thanks a ton!

                            Comment

                            Working...
                            X