florianhartig/DHARMa

Residual grouping according to RE groups that are used in the model

Opened this issue · 0 comments

Due to a question via email, I wondered if it is a problem to group residuals according to groups that also used as REs in the model.

Based on a quick simulation, I didn't see any problems with that.

library(DHARMa)
library(lme4)
testData = createData(sampleSize = 5000,numGroups = 1000, randomEffectVariance = 2)
fittedModel <- glmer(observedResponse ~ Environment1 + (1|group), family = "poisson", data = testData)

simulationOutput <- simulateResiduals(fittedModel = fittedModel, plot = F)

simulationOutput = recalculateResiduals(simulationOutput , group = testData$group)
plot(simulationOutput)

I would like to check further because I had suspected that there could be issues similar to #43