Announcement

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

  • Regression tables with esttab - display confidence interval & p-value

    Hi,

    I am using esttab to create tables after logistic regression. I present the OR & the 95%CI - is it possible to present the p-values in the same table (eg, in the next column).

    For example, if I run the following, could I also present the p-values in the table from the esttab command:

    Code:
    eststo clear
    sysuse auto, clear
    
    eststo: logistic foreign price mpg
    eststo: logistic foreign price mpg headroom weight
    
    esttab, b(%8.2f) eform ci label nonumbers mtitles("M1" "M2")
    Thanks for any help,
    Megan

  • #2
    esttab is from Stata Journal, as you are asked to explain in FAQ Advice #12.

    Code:
    eststo clear
    sysuse auto, clear
    eststo: logistic foreign price mpg
    eststo: logistic foreign price mpg headroom weight
    esttab, cells(b(fmt(3)) ci(fmt(3) par) p(fmt(3) par)) eform ///
    gaps lines collabels(none) label nonumbers mtitles("M1" "M2") ///
    addnotes("95% confidence intervals in brackets; p-values in parentheses.")
    Res.:

    Code:
    . esttab, cells(b(fmt(3)) ci(fmt(3) par) p(fmt(3) par)) eform ///
    > gaps lines collabels(none) label nonumbers mtitles("M1" "M2") ///
    > addnotes("95% confidence intervals in brackets; p-values in parentheses.")
    
    ----------------------------------------------
                                   M1           M2
    ----------------------------------------------
    Car type                                      
    Price                       1.000        1.001
                         [1.000,1.000] [1.000,1.002]
                              (0.022)      (0.003)
    
    Mileage (mpg)               1.263        0.885
                         [1.108,1.441] [0.733,1.069]
                              (0.000)      (0.204)
    
    Headroom (in.)                           1.173
                                      [0.298,4.612]
                                           (0.819)
    
    Weight (lbs.)                            0.993
                                      [0.989,0.997]
                                           (0.001)
    ----------------------------------------------
    Observations                   74           74
    ----------------------------------------------
    Exponentiated coefficients
    95% confidence intervals in brackets; p-values in parentheses.

    Comment


    • #3
      very helpful - thank you

      Comment


      • #4
        Good morning, I have a question and if I don't want the p-value to come out, if not the stars, how do I do it?

        Comment


        • #5
          Drop -p()- and add the option -star- within -b()-. And for us in economics, we want significance levels 0.01, 0.05 and 0.1.

          Code:
          eststo clear
          sysuse auto, clear
          eststo: logistic foreign price mpg
          eststo: logistic foreign price mpg headroom weight
          esttab, cells(b(fmt(3) star) ci(fmt(3) par)) eform ///
          gaps lines collabels(none) label nonumbers ///
          mtitles("M1" "M2") starlevels(* 0.1 ** 0.05 *** 0.01) ///
          addnotes("95% confidence intervals in brackets." ///
          "* p<0.1, ** p<0.05, *** p<0.01")
          Res.:

          Code:
          . esttab, cells(b(fmt(3) star) ci(fmt(3) par)) eform ///
          > gaps lines collabels(none) label nonumbers ///
          > mtitles("M1" "M2") starlevels(* 0.1 ** 0.05 *** 0.01) ///
          > addnotes("95% confidence intervals in brackets." ///
          > "* p<0.1, ** p<0.05, *** p<0.01")
          
          ----------------------------------------------------
                                         M1              M2   
          ----------------------------------------------------
          Car type                                            
          Price                       1.000**         1.001***
                               [1.000,1.000]    [1.000,1.002]   
          
          Mileage (mpg)               1.263***        0.885   
                               [1.108,1.441]    [0.733,1.069]   
          
          Headroom (in.)                              1.173   
                                               [0.298,4.612]   
          
          Weight (lbs.)                               0.993***
                                               [0.989,0.997]   
          ----------------------------------------------------
          Observations                   74              74   
          ----------------------------------------------------
          Exponentiated coefficients
          95% confidence intervals in brackets.
          * p<0.1, ** p<0.05, *** p<0.01

          Comment


          • #6
            Thank you so much!!!

            Comment


            • #7
              Originally posted by Andrew Musau View Post
              Drop -p()- and add the option -star- within -b()-. And for us in economics, we want significance levels 0.01, 0.05 and 0.1.

              Code:
              eststo clear
              sysuse auto, clear
              eststo: logistic foreign price mpg
              eststo: logistic foreign price mpg headroom weight
              esttab, cells(b(fmt(3) star) ci(fmt(3) par)) eform ///
              gaps lines collabels(none) label nonumbers ///
              mtitles("M1" "M2") starlevels(* 0.1 ** 0.05 *** 0.01) ///
              addnotes("95% confidence intervals in brackets." ///
              "* p<0.1, ** p<0.05, *** p<0.01")
              Res.:

              Code:
              . esttab, cells(b(fmt(3) star) ci(fmt(3) par)) eform ///
              > gaps lines collabels(none) label nonumbers ///
              > mtitles("M1" "M2") starlevels(* 0.1 ** 0.05 *** 0.01) ///
              > addnotes("95% confidence intervals in brackets." ///
              > "* p<0.1, ** p<0.05, *** p<0.01")
              
              ----------------------------------------------------
              M1 M2
              ----------------------------------------------------
              Car type
              Price 1.000** 1.001***
              [1.000,1.000] [1.000,1.002]
              
              Mileage (mpg) 1.263*** 0.885
              [1.108,1.441] [0.733,1.069]
              
              Headroom (in.) 1.173
              [0.298,4.612]
              
              Weight (lbs.) 0.993***
              [0.989,0.997]
              ----------------------------------------------------
              Observations 74 74
              ----------------------------------------------------
              Exponentiated coefficients
              95% confidence intervals in brackets.
              * p<0.1, ** p<0.05, *** p<0.01
              Hello, I have an additional question, and I need your help: how may I get my results in the following format in columns where column 1 is the coefficient, the second column is the confidence interval in parenthesis (1.23,1.47), and column 3 is the p-value. I appreciate your help.
              estimates confidence interval pvalue
              1.24 (1.23,1.47) 0.023

              Comment


              • #8
                Look at the placement of the double quotes within -cells()-.

                Code:
                eststo clear
                sysuse auto, clear
                eststo: logistic foreign price mpg headroom weight
                esttab, cells("b(fmt(3)) ci(fmt(3) par) p(fmt(3))") eform ///
                gaps lines collabels(OR CI p) label nonumbers ///
                nomtitles starlevels(* 0.1 ** 0.05 *** 0.01) ///
                addnotes("* p<0.1, ** p<0.05, *** p<0.01") compress
                Res.:

                Code:
                . esttab, cells("b(fmt(3)) ci(fmt(3) par) p(fmt(3))") eform ///
                > gaps lines collabels(OR CI p) label nonumbers ///
                > nomtitles starlevels(* 0.1 ** 0.05 *** 0.01) ///
                > addnotes("* p<0.1, ** p<0.05, *** p<0.01") compress
                
                ----------------------------------------------
                                        OR        CI         p
                ----------------------------------------------
                Car type                                      
                Price                1.001 [1.000,1.002]     0.003
                
                Mileage (mpg)        0.885 [0.733,1.069]     0.204
                
                Headroom (in.)       1.173 [0.298,4.612]     0.819
                
                Weight (lbs.)        0.993 [0.989,0.997]     0.001
                ----------------------------------------------
                Observations            74                    
                ----------------------------------------------
                Exponentiated coefficients
                * p<0.1, ** p<0.05, *** p<0.01
                Last edited by Andrew Musau; 06 Jun 2023, 08:39.

                Comment


                • #9
                  thank you so much, appreciate it.

                  Comment

                  Working...
                  X