I like to calculate a logistic fixed effect panel regression (conditional maximum likelihood) in R and get predicted values and/or average marginal effects.
I found two functions: bife and clogit from the survival packages
Nevertheless, the functions differ in their results and I would like to know why and how to potentially fix it. The clogit function gets me the same results as in Stata (xtlogit, fe) but I did not find a way to get average marginal/partial effects from it (explaining how to do so would also solve my problem). In bife, where the results differ from those of clogit and xtlogit in Stata, there is an option to calculate PMEs (getAPEs).
clogit:
clogit_output <- clogit(binary_variable~ x1 + x2 + x3 + strata(id), data = data)
bife:
bife_output <- bife(binary_variable ~ x1 + x2 + x3 | id, data = data, model = c("logit"))
My outcome is binary (0 or 1) and the predictors are dummy variables and numeric. I have an unbalanced panel with 10.000 respondents (id) over 12 years. I declared panel structure with:
data<- pdata.frame(data, index = c("id", "wave"))
The outcome in clogit is:
summary(clogit_output)
coef exp(coef) se(coef) z Pr(>|z|)
X1 -0.173637 0.840602 0.103450 -1.678 0.09326
X2 -0.467696 0.626444 0.115345 -4.055 5.02e-05
X3 0.743621 2.103538 0.035638 20.866 < 2e-16
for bife:
summary (bife_output)
Estimate Std. error z value Pr(> |z|)
X1 -0.2135333 0.1140698 -1.872 0.06121
X2 -0.5624223 0.1268271 -4.435 9.23e-06
X3 0.9150707 0.0399252 22.920 < 2e-16
I came so far that I assume that by using the error correction in bife (bias_corr(bife_output)) I would get the same results as in STATA or clogit. Nevertheless, in my case the error correction gives the error: Failure in step-halving.