How to return decimal result in Binomial Test in Python

Viewed 64

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')
2 Answers

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.

Actually, I found a solution to compute the log p-value instead of p-value then I could get the exact result

Related