Issue
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).
F.e. 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?
p.s. if you have some math proof, gonna be very thankful!
Solution
By definition, p-value is some area under the pdf of the test statistic under the null hypothesis.
Suppose we got a t statistic of 1.96.
For two-sided test, the p-value is by definition the area further than this statistic in both directions, i.e., 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, i.e., 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.
Answered By - j1-lee Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.