drizopoulos / GLMMadaptive

GLMMs with adaptive Gaussian quadrature
https://drizopoulos.github.io/GLMMadaptive/
60 stars 14 forks source link

Error when not converging #15

Closed strengejacke closed 5 years ago

strengejacke commented 5 years ago

I'm not sure whether this is intended or not... But when I fit a model that is not convering, an error occurs (instead of probably a warning?).

E.g. modifying your example from here: https://drizopoulos.github.io/GLMMadaptive/articles/ZeroInflated_and_TwoPart_Models.html

fm1 <- mixed_model(y ~ sex * time, random = ~ 1 | id, data = DF,
                   family = negative.binomial(), zi_fixed = ~ sex)
#> Error in while (iter < maxits && !converged) { : 
#>   missing value where TRUE/FALSE needed

This looks like a code-issue, but I'm not sure...

drizopoulos commented 5 years ago

The issue here is that you try to fit a model with a zero-inflated part, but you have not specified a zero-inflated family object. In particular, the internal optimization algorithm requires the log density function of the assumed distribution and the corresponding score vector. For the zero-inflated negative binomial these are provided in the family object zi.negative.binomial() but not in the negative.binomial() object.

I could but a warning regarding this, but this will not cover situations of user-defined family objects.

strengejacke commented 5 years ago

Ok thanks for clarification. Maybe you could still give users a hint of probable mistakes, like "did you specify the correct family" or so.

drizopoulos commented 5 years ago

Yes, I’ve done that in the development version on GitHub.

Thanks!

Best, Dimitris

From: Daniel notifications@github.com Sent: Wednesday, March 20, 2019 9:15 PM To: drizopoulos/GLMMadaptive GLMMadaptive@noreply.github.com Cc: D. Rizopoulos d.rizopoulos@erasmusmc.nl; State change state_change@noreply.github.com Subject: Re: [drizopoulos/GLMMadaptive] Error when not converging (#15)

Ok thanks for clarification. Maybe you could still give users a hint of probable mistakes, like "did you specify the correct family" or so.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdrizopoulos%2FGLMMadaptive%2Fissues%2F15%23issuecomment-475009964&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C3feec51943d34256334008d6ad70b449%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C636887096900227800&sdata=Wuvp8%2BaRRYuxKgVdE0ziKIO6acqsgmh99k7EjnIGdG8%3D&reserved=0, or mute the threadhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMn5z3uo_CiJfCXlBLPMaQj0gl5gv2o8ks5vYpa4gaJpZM4b_Is1&data=02%7C01%7Cd.rizopoulos%40erasmusmc.nl%7C3feec51943d34256334008d6ad70b449%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C636887096900237805&sdata=M4Y3KVyUIthrknpktcbXKsJEowk%2F%2BwrHGSLfb9AvV%2Bg%3D&reserved=0.