bbolker / bbmle

maximum likelihood estimation package
GNU General Public License v3.0
25 stars 13 forks source link

Using mle2 with clustered data #28

Open mclements opened 4 years ago

mclements commented 4 years ago

Ben,

How difficult would it be to adapt an mle2 object for clustered data using a sandwich estimator?

In rstpm2, I currently replace the vcov slot with a sandwich estimator, but this feels like a hack. It certainly gives the wrong estimate for confint.

Would you be able to give some guidance for where I should start with confint (and other functions that depend on the profile likelihood), please?

Sincerely, Mark.

bbolker commented 4 years ago

I think it'll be tough to combine profile likelihood CIs with sandwich estimators; in my very limited knowledge/experience, sandwich estimators etc. are very much developed in the Wald sampling framework - to that extent, your hack seems reasonable. To the extent that the log-likelihood surface is far from quadratic, I'm not even aware of the theory that would explain how to adjust it for clustered data/heteroscedasticity/etc. (except for building a model with explicit random effects, which is another can of worms ...) - not that that means it doesn't exist ...

mclements commented 4 years ago

After doing some reading: composite likelihoods have been used in this context. In particular, Chandler and Bate (2007) developed methods for "stretching" the likelihood to use a chi-squared distribution, with an implementation in the chandwich package on CRAN.

That said, I suggest you close this issue - I can use the multivariate delta method with the sandwich estimator, rather than using the profile likelihood. Thank you for your comments.