python - 在 Python 中测试 R pchisq 的等价物
问题描述
Python中是否有等效的pchisq R命令。正如在这个问题中所说,我使用的是 scipy 中的 chi2.ppf,但我没有得到与 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
提前谢谢您的帮助。
解决方案
您可以stats.chi2.cdf
在 Python 中使用:
stats.chi2.cdf(38972.27814544528,df=1)
# 1.0
推荐阅读
- php - 将 id 添加到 div,现在表单字段不是全宽
- visual-studio - MDX SSAS。TOP COUNT
- php - 如何避免无限的构造循环?
- c# - 双引号中的 SpecFlow C# Regex 可选参数
- c# - 如何从在 Linux 上运行的 .NET Core 应用程序关闭计算机
- python-2.7 - 如何使用 BioPython 获取 PubMed 出版物的日期
- ios - 捕获的 UIView 图像在全屏显示时模糊
- arrays - Django遍历混合数组
- c# - 试图从 sql 获取数据到文本框。位置 0 处没有行异常
- javascript - 为什么在 Date.prototype 中实现了“getTimezoneOffset”,而不是作为 Date 的静态方法?