为什么单尾 t 检验的 p 值/2 是正确的?

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

我有一个关于 Python 中单尾 ttest 案例的具体问题。

在很多文章中我可以看到这样的说法:

In scipy there is no direct way to indicate that we want to run a one-tailed variant of the test. However, to obtain the desired results we adjust the output ourselves. In the case of this setting, we simply need to divide the p-value by 2 (the test statistic stays the same).

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

我完全不明白,为什么除以 2 可以正常工作?

让我们看看 one-tailed/two-tailed 的历史:here

曲线下的面积相同,但从一侧看。在 z 变换之后,我们有不同的标准距离(这是 1.645,而不是 1.96)。

所以,最后的问题是:为什么我们检查相同的曲线下面积和标准距离不相同除以 2 是正确的?

p.s。如果你有一些数学证明,将非常感谢!

根据定义,p 值是原假设下检验统计量 pdf 下的某个区域。

假设我们得到的 t 统计量为 1.96。

对于双侧检验,根据定义,p 值是在两个方向上比此统计量更远的区域,即“小于 -1.96 或更多”的区域比 1.96",恰好是 0.05;这是我们进行双侧检验时的 p 值。

另一方面,对于单侧检验,根据定义,p 值是比该统计量更远的区域,在统计量 的方向上,即面积“超过1.96”。由于null下检验统计量的分布是对称的(0附近),这恰好是对应双侧检验p值的一半。