I have computed a test statistic that is distributed as a chi square with 1 degree of freedom, and want to find out what P-value this corresponds to using python.
I
For ultra-high precision, when scipy's chi2.sf() isn't enough, bring out the big guns:
chi2.sf()
>>> import numpy as np >>> from rpy2.robjects import r >>> np.exp(np.longdouble(r.pchisq(19000, 2, lower_tail=False, log_p=True)[0])) 1.5937563168532229629e-4126