简体   繁体   English

为什么单尾测试的 p 值 / 2 是正确的?

[英]Why p-value / 2 for one-tailed ttest is correct?

i have a specific question about case with one-tailed ttest in Python.我有一个关于 Python 中的单尾测试案例的具体问题。

In many articles i can read the statement like this:在许多文章中,我可以读到这样的声明:

In scipy there is no direct way to indicate that we want to run a one-tailed variant of the test.在 scipy 中,没有直接的方法表明我们要运行测试的单尾变体。 However, to obtain the desired results we adjust the output ourselves.但是,为了获得想要的结果,我们自己调整 output。 In the case of this setting, we simply need to divide the p-value by 2 (the test statistic stays the same).在这种情况下,我们只需将 p 值除以 2(测试统计量保持不变)。

Fe here https://towardsdatascience.com/one-tailed-or-two-tailed-test-that-is-the-question-1283387f631c Fe 这里https://towardsdatascience.com/one-tailed-or-two-tailed-test-that-is-the-question-1283387f631c

And i totally don't understand, why division by 2 works correctly?我完全不明白,为什么除以 2 可以正常工作?

Lets see the hist for one-tailed/two-tailed: here让我们看看单尾/双尾的历史:这里

There is just the same area under curve but from one side.曲线下的面积相同,但来自一侧。 And after z-transform we have not the same std distance (this is 1.645, not 1.96).在 z 变换之后,我们没有相同的标准距离(这是 1.645,而不是 1.96)。

So, finally question is: Why if we check the same area under curve and the std distance not the same division by 2 is correct?所以,最后的问题是:为什么如果我们检查曲线下的相同区域并且标准距离不一样除以 2 是正确的?

ps if you have some math proof, gonna be very thankful! ps如果你有一些数学证明,将非常感谢!

By definition, p-value is some area under the pdf of the test statistic under the null hypothesis.根据定义,p 值是 null 假设下检验统计量 pdf 下的某个区域。

Suppose we got at statistic of 1.96.假设我们得到了 1.96 的统计数据。

For two-sided test, the p-value is by definition the area further than this statistic in both directions , ie, the area of "less than -1.96 or more than 1.96", which happens to be 0.05;对于双边检验,p值定义为两个方向上比该统计量更远的区域,即“小于-1.96或大于1.96”的区域,恰好为0.05; this is the p-value when we do a two-sided test.这是我们进行双边检验时的 p 值。

On the other hand, for one-sided test, the p-value is by definition the area further than this statistic, in the direction of the statistic , ie, the area of "more than 1.96".另一方面,对于单面检验,p 值定义为比该统计量更远的区域,在统计量的方向上,即“大于 1.96”的区域。 Since the distribution of the test statistics under the null is symmetric (around 0), this is exactly half of the p-value of the corresponding two-sided test.由于 null 下的测试统计分布是对称的(大约为 0),因此这恰好是相应两侧测试的 p 值的一半。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM