statsmodels.genmod.families.family.Binomial.resid_anscombe¶
-
Binomial.resid_anscombe(endog, mu, var_weights=
1.0, scale=1.0)[source]¶ Anscombe残差
- Parameters:¶
- endog
ndarray 内生响应变量
- mu
ndarray 在线性预测值处的链接函数的反函数。
- var_weightsarray_like
1维方差(分析)权重数组。默认值为1。
- scale
float,optional 一个可选参数,用于将残差除以 sqrt(scale)。默认值为 1。
- endog
- Returns:¶
- resid_anscombe
ndarray 如下定义的Anscombe残差。
- resid_anscombe
注释
\[n^{2/3}*(cox\_snell(endog)-cox\_snell(mu)) / (mu*(1-mu/n)*scale^3)^{1/6} * \sqrt(var\_weights)\]其中 cox_snell 定义为 cox_snell(x) = betainc(2/3., 2/3., x)*betainc(2/3.,2/3.) 其中 betainc 是 scipy 中定义的不完全 beta 函数, 它使用的是正则化版本(使用未正则化版本,则 只需 \(cox_snell(x) = Betainc(2/3., 2/3., x)\))。
名称‘cox_snell’是特异性的,只是为了方便起见,遵循了Cox和Snell(1968)提出的方法。进一步注意 \(cox\_snell(x) = \frac{3}{2}*x^{2/3} * hyp2f1(2/3.,1/3.,5/3.,x)\) 其中hyp2f1是超几何2f1函数。Anscombe残差有时在文献中使用hyp2f1公式定义。betainc和hyp2f1都可以在scipy中找到。
参考文献
- Anscombe, FJ. (1953) “Contribution to the discussion of H. Hotelling’s
论文。”皇家统计学会会刊 B 辑。15, 229-30。
- Cox, DR and Snell, EJ. (1968) “A General Definition of Residuals.”
皇家统计学会会刊B辑. 30, 248-75.
Last update:
Oct 16, 2024