簡體   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