Closed DesmondCampbell closed 6 years ago
Hi, yes, it seems the parametric overdispersion creates an error when used on glmer.nb. I have to say I didn't try this because I never intended this to be used with the neg binom.
Can I ask why you want to test overdispersion with neg binom? As the dispersion is adjusted, one wouldn't expect overdispersion here?
-> fix: just throw a warning?
-> I also noted some unexpected behavior with refit = T, will open a new ticket for this
Reproducible example
library(lme4)
testData = createData(sampleSize = 300, overdispersion = 5, randomEffectVariance = 0, family = poisson())
fittedModel <- glmer.nb(observedResponse ~ Environment1 + (1|group) , data = testData)
simulationOutput <- simulateResiduals(fittedModel = fittedModel)
plot(simulationOutput, rank = T)
# works
testOverdispersion(simulationOutput)
# works, but produces overdispersion! -> new ticket
simulationOutput2 <- simulateResiduals(fittedModel = fittedModel, refit = T)
testOverdispersion(simulationOutput2)
# doesn't work
testOverdispersionParametric(fittedModel)
the testOverdispersionParametric(fittedModel) was in the end just a string conversion problem, fixed with https://github.com/florianhartig/DHARMa/commit/9bb149d4bf2f56169ecc39014c1c5a06dcf8f565
see further notes on simulated testOverdispersion in https://github.com/florianhartig/DHARMa/issues/48
Are you interested in the below problem with DHARMa testOverdispersionParametric() ?
The plot generated by DHARMa is
Regards Desmond