7

Does someone know an easy way to get Stata to display more than just three digits for the p-value when running a Tobit regression?

Normally Stata reports that the p-value is .001 or .065, but I would like to see more digits, for example, .0011123 or .065320.

To be clear, I don't want to (necessarily) alter the way the data is produced in the regression table.

I only want to be able to get Stata to display more digits for those p-values I am interested in.

  • 6
    Do you *really need* more than 3 digits? I would guess most people would report p-values to 2 digits for which an output of 3 digits is more than enough. Could you clarify *why* you need more digits? –  Oct 27 '10 at 17:25
  • 6
    Bonferroni corrections with large models (hundreds of variables) is one reason. – whuber Oct 27 '10 at 21:06
  • @whuber That is a very good point. –  Oct 27 '10 at 22:08
  • 2
    @suncoolsu I suspect Gunter's comment was made in a different context, probably one where someone was trying to overinterpret something like a p-value of 10^-100 or thereabouts. The fact is that interpreting and using moderately low p-values (10^-4 to 10^-6) is a significant issue: it has been the subject of national regulations and of federal litigation in the US, for instance, so it's not something to be dismissed with a flippant comment. I thank you for making clear that you offer the quotation at least partially in jest! – whuber Oct 28 '10 at 03:13
  • @whuber .. My sincere apologies, the comment was fully in jest. I removed it cuz it doesn't belong to a serious discussion like this. I actually didn't know that p-value that low is a big issue in US. Thanks for letting me know. I wonder what do they gain gain from trusting p-value that low apart from gaining the knowledge "something is wrong". – suncoolsu Oct 28 '10 at 03:25
  • @suncoolsu It shows up in regulations governing the monitoring of the environment. Monitoring programs can result in conducting tens of thousands of tests simultaneously, creating a need to avoid false positive results. – whuber Oct 28 '10 at 14:06
  • @whuber Thanks you very much ! .. I really value the knowledge that I gain from this forum! – suncoolsu Oct 28 '10 at 18:20
  • Thanks everyone for the input! –  Nov 01 '10 at 14:37

5 Answers5

9

Follow up the tobit command with

est tab, p(%12.10g)

(for example). This ought to work even in pretty old versions of Stata. A little less easy is to write your own output procedure.

whuber
  • 2,379
  • 14
  • 23
  • 1
    Good idea. I'd add that -est tab- is an abbreviation (understood by Stata) for the built-in command -estimates table-. That was introduced with the release of Stata 8.0 in 2003. – onestop Oct 28 '10 at 07:20
5

Stata 11.1 introduced a set pformat command that specifies the output format of p-values in coefficient tables. (I don't know about STATA I'm afraid as I think that was discontinued some time in the 1980s).

By the way, you'd probably be better off asking such completely Stata-specific questions on Statalist rather than here.

onestop
  • 800
  • 5
  • 10
  • 1
    To avoid the need to lookup formats - `set pformat %5.4f, perm` will increase the displayed value in the output table from 3 to 4 decimal places – kyrenia May 11 '17 at 13:10
1

A lot of times, you can get the utmost precision if you know your p-value by its internal name. I usually type return list or ereturn list after nearly every command that I will seriously use, and then grab results that may look like e(p) or r(p) or e(p_chi2) or whatever the scalar that contains the p-value might be.

StasK
  • 1,525
  • 10
  • 21
  • Whenever possible, I do this too. However, p-values are not always "left behind" after estimation commands (`ereturn list`). A nice way to get the p-values from those commands is described here (http://www.stata-journal.com/sjpdf.html?articlenum=st0137) and uses some basic `mata` functions. However, the `set pformat` and `set tab` solutions are much more convenient. –  Aug 18 '12 at 07:35
0

After a tobit regression, you can use the test command to get the p-value from the null hypothesis x1=0:

sysuse auto
tobit weight trunk length headroom, ll(1500)
test trunk

The result returned in r(p)

return list
Keith
  • 1,037
  • 6
  • 13
0

Using the first example from the tobit command help file:

. sysuse auto, clear
. generate wgt = weight / 1000

. tobit mpg wgt, ll(17)

Tobit regression                                Number of obs     =         74
                                                LR chi2(1)        =      72.85
                                                Prob > chi2       =     0.0000
Log likelihood = -164.25438                     Pseudo R2         =     0.1815

------------------------------------------------------------------------------
         mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         wgt |   -6.87305   .7002559    -9.82   0.000    -8.268658   -5.477442
       _cons |   41.49856    2.05838    20.16   0.000     37.39621     45.6009
-------------+----------------------------------------------------------------
      /sigma |   3.845701   .3663309                      3.115605    4.575797
------------------------------------------------------------------------------
            18  left-censored observations at mpg <= 17
            56     uncensored observations
             0 right-censored observations

You can easily obtain any p-value from the returned results in r():

. matrix list r(table)

r(table)[9,3]
             model:      model:      sigma:
               wgt       _cons       _cons
     b  -6.8730504   41.498557   3.8457011
    se   .70025591   2.0583803   .36633085
     t  -9.8150552   20.160782          .b
pvalue   5.610e-15   1.471e-31          .b
    ll  -8.2686584   37.396211   3.1156048
    ul  -5.4774424   45.600903   4.5757975
    df          73          73          73
  crit   1.9929971   1.9929971   1.9929971
 eform           0           0           0

And then format it accordingly:

. matrix results = r(table)

. display %18.17f results[4,1]
0.00000000000000561

Type help format from Stata's command prompt for more information.