【问题标题】:Calculating AIC for Fixed Effect logit from bife package从 bife 包计算固定效应 logit 的 AIC
【发布时间】:2020-04-26 11:39:45
【问题描述】:

我想问如何计算inf。标准如 AIC 等...用于固定效应 logit 模型来自 bife 包。

基本summmary 输出不包括 AIC,但查看时如何:Goodness-of-fit for fixed effect logit model using 'bife' package

计算了 AIC 标准。我怎么在我的摘要输出和对数似然中都没有它。

dta = bife::psid
mod_logit <- bife(LFP ~ AGE + I(INCH / 1000) + KID1 + KID2 + KID3 | ID, data = dta, bias_corr = "ana")
summary(mod_logit)

【问题讨论】:

    标签: r statistics logistic-regression log-likelihood goodness-of-fit


    【解决方案1】:

    如果您检查bife 代码,AIC 是在早期版本中计算的,至少在版本 0.5 中。您可能正在使用不再包含 AIC 的当前版本 0.6。

    如果您不介意使用旧版本,请尝试以下操作:

    1. 从您的库中删除当前版本。

    2. 从 CRAN 网站下载 0.5 版:https://cran.r-project.org/src/contrib/Archive/bife/

    3. 安装到您的计算机:install.packages("D:\\bife_0.5.tar.gz", repos = NULL, type="source"). 假设它存储在 D: 驱动器上。

    或者:

    require(devtools)
    install_version("bife", version = "0.5", repos = "http://cran.us.r-project.org")
    

    如果安装成功,请在包含 AIC 的情况下运行以下命令:

    library(bife)
    dta = bife::psid
    mod_logit <- bife(LFP ~ AGE + I(INCH / 1000) + KID1 + KID2 + KID3 | ID, data = dta, bias_corr = "ana")
    summary(mod_logit)
    #> ---------------------------------------------------------------
    #> Fixed effects logit model
    #> with analytical bias-correction
    #> 
    #> Estimated model:
    #> LFP ~ AGE + I(INCH/1000) + KID1 + KID2 + KID3 | ID
    #> 
    #> Log-Likelihood= -3045.505 
    #> n= 13149, number of events= 9516
    #> Demeaning converged after 5 iteration(s)
    #> Offset converged after 3 iteration(s)
    #> 
    #> Corrected structural parameter(s):
    #> 
    #>               Estimate Std. error t-value  Pr(> t)    
    #> AGE           0.033945   0.012990   2.613  0.00898 ** 
    #> I(INCH/1000) -0.007630   0.001993  -3.829  0.00013 ***
    #> KID1         -1.052985   0.096186 -10.947  < 2e-16 ***
    #> KID2         -0.509178   0.084510  -6.025 1.74e-09 ***
    #> KID3         -0.010562   0.060413  -0.175  0.86121    
    #> ---
    #> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
    #> 
    #> AIC=  9023.011 , BIC=  19994.7 
    #> 
    #> 
    #> Average individual fixed effects= 0.0122
    #> ---------------------------------------------------------------
    

    reprex package (v0.3.0) 于 2020-01-09 创建

    【讨论】:

      猜你喜欢
      • 2020-05-17
      • 2020-09-24
      • 2019-09-14
      • 2021-08-18
      • 2022-06-15
      • 2018-07-31
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      相关资源
      最近更新 更多