如何获得 p 值的更多位数?

发布于 2024-09-29 14:10:02 字数 249 浏览 0 评论 0原文

有人知道一种简单的方法让 Stata 在运行 Tobit 回归时显示多于三位数字的 p 值吗?

通常,Stata 报告 p 值为 .001.065,但我希望看到更多数字,例如 .0011123.065320

需要明确的是,我不想(必要)改变回归表中数据的生成方式。

我只想让 Stata 为我感兴趣的 p 值显示更多数字。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

分開簡單 2024-10-06 14:10:02

执行 tobit 命令

使用est tab, p(%12.10g)

(例如) 。即使在相当旧的 Stata 版本中,这也应该可以工作。稍微不太容易的是编写自己的输出过程。

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.

忆梦 2024-10-06 14:10:02

Stata 11.1 引入了 set pformat 命令,指定系数表中 p 值的输出格式。 (我不知道 STATA 恐怕因为我认为它已经停产了20世纪80年代的某个时候)。

顺便说一句,您可能最好在 Statalist 上提出此类完全针对 Stata 的问题,而不是在这里。

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.

时光匆匆的小流年 2024-10-06 14:10:02

很多时候,如果您通过内部名称了解 p 值,则可以获得最高的精度。我通常在几乎每个我会认真使用的命令之后输入 return listereturn list,然后获取可能类似于 e(p) 的结果> 或 r(p)e(p_chi2) 或包含 p 值的任何标量。

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.

你怎么敢 2024-10-06 14:10:02

经过 tobit 回归后,您可以使用 test 命令从原假设 x1=0 中获取 p 值:

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

r(p) 返回的结果

return list

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
删除→记忆 2024-10-06 14:10:02

使用 tobit 命令帮助文件中的第一个示例:

. 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

您可以轻松地从 r() 中返回的结果中获取任何 p 值:

. 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

然后相应地格式化它:

. matrix results = r(table)

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

键入 <从 Stata 的命令提示符中输入 code>help format 以获取更多信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文