简体   繁体   中英

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

i have a specific question about case with one-tailed ttest in 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. 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).

Fe here 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?

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).

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?

ps if you have some math proof, gonna be very thankful!

By definition, p-value is some area under the pdf of the test statistic under the null hypothesis.

Suppose we got at statistic of 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; this is the p-value when we do a two-sided test.

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". 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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