Announcement

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

  • Accessing the t-stat and p-values from -logit- results.

    Greetings, I have successfully done this with regression results. There is a great post that shows how to accomplish the task from regression results here:

    http://www.stata.com/statalist/archi.../msg00892.html

    But, I want to do the same thing (or the equivalently the same thing) following logit output.

    The problem I've deduced is that the e(df_r) value is not something logit provides (no surprise, different method).

    So another way to put my question is where I might find example stata code that calculates the p-value from logit output.

    Any hints?

  • #2
    Looking at -ereturn list- after the logit command, you'll see, among other things, e(p), which has the p-value from the likelihood ratio test of the model. No calculation required. Was there something else you wanted there?

    Comment


    • #3
      Adam,

      If you are interested in the p-values for each covariate in the model, the same technique can be used, as the _b[] and _se[] vectors are output by logit. To confirm:

      Code:
      sysuse auto
      logit foreign price
      di _b[price]
      di _se[price]
      Regards,
      Joe

      Comment


      • #4
        Further, logit produces p-values using a z-test, which is just the coefficient divided by the standard error, so no need for the degrees of freedom.

        Comment


        • #5
          Note that r(table) makes this a lot easier than it used to be. You can use matrix commands to extract what you want.

          Code:
          sysuse auto
          logit foreign mpg price
          mat list r(table)
          
          . mat list r(table)
          
          r(table)[9,3]
                     foreign:    foreign:    foreign:
                         mpg       price       _cons
               b   .23383526   .00026602  -7.6481113
              se   .06714485   .00011658   2.0436728
               z   3.4825492   2.2819311  -3.7423365
          pvalue   .00049666   .02249341   .00018232
              ll   .10223376   .00003753  -11.653636
              ul   .36543675    .0004945  -3.6425862
              df           .           .           .
            crit    1.959964    1.959964    1.959964
           eform           0           0           0
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

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

          Comment


          • #6
            Hello, I'm bumping this old thread because it is directly relevant to my task.

            My question is - is it possible to collect the data from that matrix Richard mentioned in one go via the statsby command? statsby works perfectly when collecting coefficients, se's and some other things and then putting them all into a neat table, but it doesn't pick the p values and confidence intervals that I need.

            Here's a pseudo code that I need to work
            Code:
            sysuse auto, clear
            statsby _b ###reference to the relevant p value of the coefficient###, by (rep78) saving (results): logit foreign price mpg
            Any idea how to make it work as I expect?
            Thanks

            Comment


            • #7
              I have the same problem as Evgeny.
              Thanks.

              Comment


              • #8
                Here is how I would do this:

                Code:
                sysuse auto, clear
                tempfile res
                statsby _b _se, by(rep78) saving(`res'): logit foreign price mpg
                use `res'
                
                foreach var in price mpg cons {
                    gen z_`var' = foreign_b_`var' / foreign_se_`var'
                    gen p_`var' = 2*normal(-abs(z_`var'))
                }
                Also see: M. Buis (2007) Stata tip 53: Where did my p-values go? The Stata Journal, 7(4):584-586.
                http://www.stata-journal.com/article...article=st0137
                ---------------------------------
                Maarten L. Buis
                University of Konstanz
                Department of history and sociology
                box 40
                78457 Konstanz
                Germany
                http://www.maartenbuis.nl
                ---------------------------------

                Comment

                Working...
                X