4jano20
4jano20

Reputation: 35

Testing equivalents to R pchisq in Python

Is there a equivalent of pchisq R command in Python. As was said in this question, I were using chi2.ppf from scipy but I am not getting the same results as in R. For example, the following code:

R:

pchisq(38972.27814544528, df = 1)
Out: 1

pchisq(40569.99000034796, df = 1)
Out: 1

Python:

chi2.ppf(38972.27814544528, df = 1)
Out: NaN

chi2.ppf(40569.99000034796, df = 1)
Out: NaN

Thaks in advance for the help.

Upvotes: 1

Views: 600

Answers (1)

Peace Wang
Peace Wang

Reputation: 2419

You can use stats.chi2.cdf in Python:

stats.chi2.cdf(38972.27814544528,df=1)
# 1.0

Upvotes: 3

Related Questions