Wednesday, August 10, 2022

[FIXED] How to return decimal result in Binomial Test in Python

Issue

I am running a binomial test in python, since the P-value result is too close to 0 so it return 0 directly, but I want to return the exact P value instead of 0, how could I do that?

The code is below

from scipy import stats

p=stats.binom_test(4953,850421,0.002691, alternative='greater')

Solution

The tolerance of this library is e^-16. Thus, I think it is not possible to get a p-value in this case. In statistics, p-value is the probability of success under conditions of null hypothesis. We require to compare it with 0.01, 0.05, and 0.1 under different alpha-value. Thus, it is useless to use any other value like 0.005. It indicates that assuming null hypothesis is true is misleading. If we use a infinitesimal small probability of making type-I error then the probability of making type-II error will be significantly high.



Answered By - Aaditya Bhardwaj
Answer Checked By - David Marino (PHPFixing Volunteer)

No comments:

Post a Comment

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