Open droodman opened 5 months ago
Thanks for the report, and sorry that it took a while to respond. I'm trying to at least ensure that GLFixedEffectModels is not giving wrong answers, and your issue got me worried :)
The difference is due to GLFixedEffectModels.jl using different starting values than GLM.jl. Try the following, which yields for me the same estimates as GLM:
nlreg(df, @formula(low ~ age+lwt+smoke+ptl+ht+ui + fe(race)), Binomial(), LogitLink(), start = zeros(Float64, 6))
Picking good starting values is not straightforward, see e.g. here . R's glm
does something complicated, I believe. I haven't quite understood what GLM.jl is doing, but it seems closer to choosing zeros. I could change the default start values to zero, which would help in this situation, but it's quite possible that there will be other situations where the outcome is worse (right now it's using 0.1 .* ones(...)
, which is probably not a good idea).
Would it make sense to call GLM to pick the starting values?
My cmp package for Stata does something like that. Before fitting a multi-equation model, where the equations could be linear, probit, tobit, etc., it runs the relevant Stata command on each equation separately to pick starting values for coefficients. Indeed, I might even make reghdfejl
do that before calling GLFixedEffectModels.
I'm getting different results where I think there should be a match, unless I'm doing something wrong. This uses the file https://www.stata-press.com/data/r18/lbw.dta.