Search code examples
rmethodsregressionconfidence-interval

Confidence intervals gives NA values with BIFE


I am trying to extract the confidence intervals for my panel logit regression. I am using the following code:

model <- bife(dependent_variable ~ x1 + x2 | area, data = df, model = 'logit')
confint(model)

Running confint gives me NA values for all the coefficients and their confidence intervals.

Is this because of the 'bife' object? The model itself runs fine.


Solution

  • It's the bife:::vcov.bife method which doesn't produce dimnames. Until the author fixes this, we could help ourselves by writing a confint.bife method, that assigns coefficient names to the vcov.

    confint.bife <- function (object, parm, level=0.95, ...) {
      cf <- coef(object)
      pnames <- names(cf)
      if (missing(parm)) parm <- pnames
      else if (is.numeric(parm)) parm <- pnames[parm] 
      a <- (1 - level)/2
      a <- c(a, 1 - a)
      pct <- stats:::format.perc(a, 3)
      fac <- qnorm(a)
      ci <- array(NA, dim=c(length(parm), 2L), 
                  dimnames=list(parm, pct))
      vc <- `dimnames<-`(vcov(object), list(pnames, pnames))
      ses <- sqrt(diag(vc))[parm]
      ci[] <- cf[parm] + ses %o% fac
      ci
    }
    
    library('bife')
    mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 +
                  factor(TIME) | ID, psid)
    
    confint(mod)
    #                      2.5 %       97.5 %
    # I(AGE^2)      -0.003787755 -0.001185755
    # log(INCH)     -0.606681358 -0.236717893
    # KID1          -1.393748723 -1.008131941
    # KID2          -0.830532213 -0.485097762
    # KID3          -0.248997085  0.012550225
    # factor(TIME)2 -0.244728227  0.303869081
    # factor(TIME)3 -0.190434814  0.438179674
    # factor(TIME)4  0.117647679  0.870167422
    # factor(TIME)5  0.635239557  1.547524672
    # factor(TIME)6  0.613792831  1.689971248
    # factor(TIME)7  0.639896725  1.876532219
    # factor(TIME)8  0.585828050  2.017753781
    # factor(TIME)9  0.753717289  2.381327746