I have recently started using logistf in R and find that I am getting strange results. Namely, sometimes the confidence intervals for the coefficient cross 0, despite having a strongly significant p-value, and vice versa.
For example
outcome <- as.factor(c(0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1))
predictor <- c(0,5,5,5,5,5,5,5,5,5,5,5,1,0,0,0,0)
logistf(outcome ~ predictor)
In my output, I discover the coefficient for my predictor to be -0.4 (95% confidence interval -2 to 7). However, the p-value is 0.00000352.
Can anyone explain how I am using this penalised logistic regression method incorrectly as this result seems to be inconsistent?
glm(..., family = binomial)andlogistf(..., firth = FALSE)give quite radically different coefficient estimates even though they're both using maximum likelihood to estimate the coefficients. Maybe this package has a bug in it. You can perform the same analysis using thebrglm2package, which has results more in line with what you get usingglm(). – Noah Apr 06 '20 at 06:56