且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 rpy2 中的 R lme 模型中提取系数

更新时间:2023-12-02 13:52:04

rx2 方法对应于 R 的 [[,我理解与 相同$.

The method rx2 corresponds to R's [[, which I understand to be identical to $.

考虑到这一点,您可以像访问系数"一样访问系数"中名为固定"的项目:

With that in mind, you can access the item called "fixed" within "coefficients" the same way you are already accessing "coefficients":

# Python sequences are zero-based
model.rx2("coefficients").rx2("fixed")[1]

# R vectors are one-based (so 1+1=2)
model.rx2("coefficients").rx2("fixed").rx(2)