[英]I think I am getting different AIC & BIC values in a regression model built using statsmodel package in Python
I built a single factor (univariate regression) model and when I do 我建立了一个单因素(单变量回归)模型,
aic = results.aic
and when do 什么时候做
aic = results.nobs*np.log(results.ssr/results.nobs) + 4
I get different outputs. 我得到不同的输出。 Which one is correct? 哪一个是正确的?
The second formula gives the same results as SAS Base 9.4 outputs 第二个公式给出的结果与SAS Base 9.4输出相同
aic = results.aic #from statsmodel packages
aic = results.nobs*np.log(results.ssr/results.nobs) + 4
Calculation between AIC in statsmodels and SAS differ when it comes to model dimension interpretation. 在模型尺寸解释方面,statsmodels中的AIC与SAS之间的计算有所不同。
In statmodels, aic looks like: 在statmodels中,aic看起来像:
Statsmodels Eval_metrics source code Statsmodels Eval_metrics源代码
def aic(llf, nobs, df_modelwc):
return -2. * llf + 2. * df_modelwc
where df_modelwc is df_modelwc在哪里
df_modelwc : int
number of parameters including constant
while in SAS interpretation: 而在SAS解释中:
SAS Mixed Procedure Documentation SAS混合程序文档
AIC looks like AIC看起来像
-2LL + 2d, where 'd is an effective number of estimated covariance parameters'. -2LL + 2d,其中“ d是估计的协方差参数的有效数量”。
Both of the interpretations are correct, but you cannot compare goodness of fit measure based on interpretation from two different sources. 两种解释都是正确的,但是您不能基于两个不同来源的解释来比较拟合度的优劣。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.