Closed RaduUrian closed 7 months ago
Hello,
not all all, your issues is very detailed and well formulated.
The problem is that I can't reproduce the error. The first code seems to be missing a line of code where simulationOutput is created but the second chunk runs for me without problems. I also don't see any errors in the automatic checks of the package. The error complains about the aggregateBy = sum option set in the function, but I don't understand why. A potential option is that you created a variable or function called sum somewhere in your R session that overwrites the R default sum function.
Can you complete restart R and Studio, start with a clean and empty session and confirm that the following code:
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)
indeed produces an error?
Thank you for your prompt answer. You're correct, as the chunk you provided works without an error in a new session with a cleared environment. I can still reproduce the error on my old session even with a clean environment, so there must be something in my session info or in interactions with the (many) loaded packages that causes the error. Thank you for your help, this has really clarified my issue and hopefully I can find a quick solution. Thank you for the amazing package btw!
If a loaded package overwrites sum, it might help to provide aggregateBy = base::sum
to recalculateResiduals
.
OK, I assume that this is solved, if not please reopen.
Hi Prof. Hartig,
I was assessing the performance of a glmer binomial model (1/0 Bernoulli) by following the DHARMa vignettes for binomial models you provided. However, I ran into an error when trying to group the simulated residuals by the random effect variable in my model using recalculateResiduals(). The error code is:
Error in get(as.character(FUN), mode = "function", envir = envir) : object 'aggregateBy' of mode 'function' was not found
The exact code from the recalculateResiduals() vignettes also produces the same error:
Similar error with the slightly modified code you suggested in issue #383:
Is this a known error or something that you can reproduce using the vignette code? Or is it a client-side issue on my part?
DHARMa 0.4.6 Session info:
*I'm unfamiliar with posting issues on GitHub, so please let me know if this is not up to the acceptable standard. **Update first code chunk based on comments to accurately reflect the vignette codes.