PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, October 8, 2022

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

 October 08, 2022     p-value, python, scipy, statistics     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing