繁体   English   中英

Python 中的 GLM 残差 statsmodel

[英]GLM Residual in Python statsmodel

如何为 Python 中的所有 303 个观测值生成残差:

from statsmodels.stats.outliers_influence import OLSInfluence
OLSInfluence(resid)

或者

res.resid()

我正在尝试生成类似于我们在 R 中生成的残差:

res$resid

statsmodels 没有GLM的默认resid ,但它具有以下内容

resid_anscombe Anscombe 残差。

resid_anscombe_scaled 缩放的 Anscombe 残差。

resid_anscombe_unscaled 未缩放的 Anscombe 残差。

resid_deviance 偏差残差。

resid_pearson 皮尔逊残差。

resid_response 响应残差。

resid_working 工作残差。

https://www.statsmodels.org/stable/generated/statsmodels.genmod.generalized_linear_model.GLMResults.html

残差y - E(y|x)是响应残差resid_response

这些残差可用作fit方法返回的结果实例的属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM