在 Windows 7 64 上的 python 脚本中执行 GLM

发布于 2024-09-29 07:45:13 字数 1047 浏览 2 评论 0原文

我正在尝试在 python 脚本(循环内)中重复执行 GLM(广义线性模型)。

1-我尝试在 Scipy glm 函数中使用 Stats,但描述非常不存在,我认为我没有很好地使用它 -->错误信息

"ValueError: only ttest_ind implemented".
I searched within stats.py file and in _support.py to find my way without results.

2-我尝试安装 RPY2(希望 lgautier 或其他人会读我)或使用 R 驱动的功能。但我是windows 7 64,看来我没有成功安装好。我有错误消息:

    import rpy2.tests
  File "C:\Python26\lib\site-packages\rpy2\tests.py", line 3, in 
    import rpy2.robjects.tests
  File "C:\Python26\lib\site-packages\rpy2\robjects\__init__.py", line 12, in 
    import rpy2.rinterface as rinterface
  File "C:\Python26\lib\site-packages\rpy2\rinterface\__init__.py", line 22, in 
    "This might be because R.exe is nowhere in your Path.")
RuntimeError: Unable to determine R version from the registery.Calling the command 'R RHOME' does not return anything.
This might be because R.exe is nowhere in your Path.

如何在 python 中执行健壮的 GLM(其他方法?,我尝试了好的方法,但我错过了......?)? 如何在 Windows 7 64 上安装 RPY(新手/基础学生学习者)并与 python 连接?

I'm trying to perform GLM (Generalized linear model) repeatedly within a python script (within a loop).

1- I tried to use Stats within Scipy glm function but description is quite inexistant and I think I did not use it well --> error message

"ValueError: only ttest_ind implemented".

I searched within stats.py file and in _support.py to find my way without results.

2- I have tried to install RPY2 (hope that lgautier or other will read me) ot use R powered functions. But I'm on windows 7 64, and it seems that I did not succeed to install it well. I have error message:

    import rpy2.tests
  File "C:\Python26\lib\site-packages\rpy2\tests.py", line 3, in 
    import rpy2.robjects.tests
  File "C:\Python26\lib\site-packages\rpy2\robjects\__init__.py", line 12, in 
    import rpy2.rinterface as rinterface
  File "C:\Python26\lib\site-packages\rpy2\rinterface\__init__.py", line 22, in 
    "This might be because R.exe is nowhere in your Path.")
RuntimeError: Unable to determine R version from the registery.Calling the command 'R RHOME' does not return anything.
This might be because R.exe is nowhere in your Path.

How to perform robust GLM in python (other ways?, I tried good ones but I missed ...?)?
How to install RPY (noob/basic student learner) on windows 7 64 and interface it with python?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愁以何悠 2024-10-06 07:45:13

我不知道为什么这里的答案似乎表明 GLM 的 statsmodels 测试覆盖率不是那么好。我写了测试。这些模型经过 Stata、R 和 SAS 验证。它们相当全面。如果您发现意外情况或情况并非如此,请向开发人员报告。

https://github.com/statsmodels/statsmodels /blob/master/scikits/statsmodels/genmod/tests/test_glm.py

I don't know why the answers here seem to indicate that statsmodels test coverage for GLM is not that good. I wrote the tests. The models are verified against Stata, R, and SAS. They're pretty comprehensive. If you find something unexpected or this not to be the case then please report it to developers.

https://github.com/statsmodels/statsmodels/blob/master/scikits/statsmodels/genmod/tests/test_glm.py

伪心 2024-10-06 07:45:13

在我最后一条评论后不久,我发现了这个:

http://statsmodels.sourceforge.net/

及其 GLM此处的文档:

http://statsmodels.sourceforge.net/glm.html

我强烈建议与 R 的拟合进行交叉检查,以确保它按照您的想法进行。

And shortly after my last comment, I find this:

http://statsmodels.sourceforge.net/

with its GLM documentation here:

http://statsmodels.sourceforge.net/glm.html

I'd strongly suggest cross-checking with R's fit as well to make sure it's doing what you think.

花落人断肠 2024-10-06 07:45:13

我回答我:

statsmodels 的开发和测试还不够充分,无法使用,所以在当前版本中不要使用 STATSMODELS 来执行 GLM --> rpy2 是合适的,但需要一些复杂的安装(复制到从 rpy2 tar 提取的 /Pythonxx/Lib/site-packages/ 文件夹中并获取“nose”并将其复制到同一位置)

I answer at me:

statsmodels are not developed and tested enough to be employed, so DO NOT USE STATSMODELS in its current version to perform GLM --> rpy2 is appropriate but need some complicated install (copy into /Pythonxx/Lib/site-packages/ folders extracted from rpy2 tar and get 'nose' and copy it at the same place)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文