-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error for simulateResiduals() when refit=T #17
Comments
Thanks for reporting this - I assume if you could dput your data, you would have done it, right? But anyway, also without data, the problem is obviously that, for at least one of the 500 simulated datasets, the refit with lme4 does not converge and produces an error. This is fundamentally an lme4 problem, but I should changed the code to catch these errors, so that the failing model gets removed from the refit, and DHARMa doesn't stop. I have noted this under #18, but I don't have the time to do this immediately. In the meantime, 3 remarks: a) I don't really see a statistical reason to use refit = T in your case, so l would suggest to simply use refit = F b) The problem may disappear when changing the optimizer, use control=glmerControl(optimizer="bobyqa") c) The fact that the error occurs probably has something to do with the structure of your data. Either your dataset is very small, or the distribution of your predictors are such that the optimizer gets problems (do you have enough observations per RE?). You will find lots of case studies = error reports if you search, e.g. lme4/lme4#133 . |
a) Thanks for the feedback! If refit=T could be written with the changes you mentioned (such that the failed simulations are removed), I would like to use the testOverdispersion() function. b) Using the bobyqa optimizer, refit=T worked, albeit with >50 warnings. Are the results still valid, or would you recommend trying a different method of estimating over/underdispersion? c) This is very likely the case. There are a lot of missing observations both within the "Day" random effect and for individual trees in the fixed effects. It's far from ideal; I'm just trying to make the best of analysis possible out of the data I have. Thank you for developing this package! It definitely makes diagnostics of GLMMs much much easier, especially for thick-skulled ecologists like me who simply can't take every statistics course offered in the course of an MS. |
a) it looks like you are running a binomial with 1/0 data. With 1/0 data, you generally don't look for dispersion, because your data are either too high or too low, they cannot be "more spread out than expected" (definition of overdispersion) - the testOverdispersion() function will still react to problems with 1/0 data (it tests fitted likelihoods against expected), but if it shows a problem, you should call it a signal of misfit, not overdispersion. If you want to test for overdispersion in a 1/0 binomial, you need to group your data. But again, asfaiks, in your case with one predictor, the standard DHARMa plot is totally sufficient for you - I'm going on the record here saying: if you see no clear problems there + no spatial autocorrelation, you're good! b) I guess the warnings are convergence warnings - results are probably still fine, but one cannot be sure. Glad you find the package useful! |
Hi Regal, I have implemented something, but it is difficult to test for me because I haven't managed to find / create a dataset that makes lme4 crash in that way. Having your dataset via email (confidentially) would be a great help. |
Will do! |
Implemented in d5cfe8f Regal, if you install the development version (see main page), does this solve your problem? |
Hi Regal, this should be fixed in DHARMa 0.1.5 on CRAN - a feedback if this solves your problem would be appreciated. Anyway, I will close this now. |
I'm afraid it might not be easy to give reproducible code for this, but I'll give as much information as I can. I receive no warnings in the model itself, but
simulateResiduals(binary.glmer, n=500, refit=T)
gives the following error:Any suggestions would be appreciated. I always get this warning with this model, but I've run similar models on similar data structures that worked alright.
Model:
binary.glmer <- glmer(Status ~ Line + (1|Day), data=ParBin.data, family="binomial", nAGQ=25)
Data:
sessionInfo():
The text was updated successfully, but these errors were encountered: