Search code examples
rstatisticslogistic-regressionlog-likelihoodgoodness-of-fit

Calculating AIC for Fixed Effect logit from bife package


I would like to ask how to calculace inf. criteria such as AIC, etc... for Fixed effect logit model from bife package.

Basic summmary output does NOT include AIC, how ever when looking at: Goodness-of-fit for fixed effect logit model using 'bife' package

The AIC criterium was computed. how ever I do no have it in my summary output nor log-likelihood.

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

Solution

  • If you check bife code, AIC was computed in earlier versions at least in version 0.5. You might be using the current version 0.6 in which AIC is no longer included.

    If you do not mind using the older version, try the following:

    1. remove the current version from your library.

    2. download version 0.5 from CRAN website: https://cran.r-project.org/src/contrib/Archive/bife/

    3. install to your computer: install.packages("D:\\bife_0.5.tar.gz", repos = NULL, type="source"). Assuming it is stored on D: drive.

    Or:

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

    If successfully installed, run the following with AIC included:

    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
    #> ---------------------------------------------------------------
    

    Created on 2020-01-09 by the reprex package (v0.3.0)