Comments (6)
Hello,
this is expected (however, admittedly, not ideal behaviour). The reason behind this is the following:
-
DHARMa residuals are not expected to change when including REs, in particular REs with covariance structures, because glmmTMB does not (yet) allow to condition simulations and predictions on the fitted REs. Basically DHARMa residuals are calculated around your fixed effect structure (though they re-simulate the REs). See #16 and just opened issue glmmTMB/glmmTMB#888.
-
glmmTMB residuals are calculated conditional on fitted REs, so in this case you see the residual correlation minus the RE structure.
How to fix this:
First of all, the fact that your autocorrelation structure disappears with glmmTMB residuals (either unstructured or with a structured RE) means that the REs are temporally autocorrelated, so you should fit an AR1 structure.
Ifs you test a glmmTMB model with covariance in the REs (such as AR1) in DHARMa, you can currently either ignore the autocorrelation, or use the rotation argument, see #364. I hope that the glmmTMB developers will include an option to condition simulations on the fitted REs in the future, which should produce similar residuals as you produce with act(residuals(model)).
from dharma.
Hi Florian,
Thanks for the quick and helpful response! I didn't realize that the DHARMa residuals for glmmTMB are not conditioned on the RE structure, but then it makes complete sense that the autocorrelation would still be present.
I'm fine with ignoring the autocorrelation in DHARMa until glmmTMB #888 is addressed.
But I did try the rotation argument and am still not getting the same results as acf
. That's also to be expected, right? Because as you said in #301, "The problem, however, is that this will likely only work perfectly for symmetric linear homogenous cdfc, such as the multivariate normal." So, hypothetically, since I'm seeing a decrease in the autocorrelation structure by including the rotation argument, that's indicative that the AR1 structure is effective, even though the autocorrelation isn't completely solved by DHARMa's calculations?
This is mostly out of curiosity at this point, because as I said, I'm fine with continuing to use glmmTMB's residuals and acf
to detect autocorrelation structure.
Thanks again!
Michelle
from dharma.
Hello Michelle,
you tried this on your AR1 model, right? My comments referred to real GLMMs - in your case, you essentially fit an LMM, so the rotation should be exact, provided your nSim is large enough.
By exact, I mean that the autocorrelation part of the AR1 model is correctly removed, and if you see autocorrelation remaining in the DHARMa residuals with rotation, you should probably interpret this as some kind of signal remaining.
There are still differences between the residuals, because DHARMa does not condition on your other REs, so the residuals will differ in their exact numeric values. It could be that some of the other REs absorb autocorrelation. In particular, in your model, you have both
(1 | date)
ar1(date + 0 | id)
The (1 | date) will likely absorb autocorrelation that does not fit the form of the AR1, which would show up in DHARMa but not in the glmmTMB plots. You could test this by calculating the acdf acf on the fitted REs of (1 | date)
Cheers,
Florian
from dharma.
from dharma.
typo, I meant acf
from dharma.
OK, I will consider this closed for the moment, in case you have further questions feel free to re-open the issue!
from dharma.
Related Issues (20)
- Dealing with non-uniform residuals in y-direction when plotted against predictor(s) HOT 2
- testDispersion() default fails to detect overdispersion in a Poisson GLMM HOT 4
- Question about using DHARMa for Bernoulli Response Data
- Add support for nls
- Diagnostic plots for model using glmmTMB and Beta distibution HOT 6
- could not find function "ensureDHARMa"
- plotResiduals() falls back to predict and doesn't create a warning if variable doesn't exist
- Implement option to use DHARMa plots on general residual definition (bypassing simulation)
- Power of the KS test HOT 1
- How to resolve the residual versus predicted quantile devation (Dharma plot)?
- Could not find documentation on red-shaded area around smooth spline HOT 2
- Pattern in RE-grouped residual for binomial GLMM HOT 2
- Adjust DHARMa plots for color blindness
- DHARMa: fittedModel not in class of supported models for a glmmTMB model HOT 3
- Dispersion calculations for mdcv tweedie distribution HOT 1
- Clarify dispersion tests
- Extracted Pearson residuals wrong for mccv (type should be "scaled.pearson")
- Adding support for multinomial family in mcvc::gam HOT 4
- Simulations with infitite values for weighted binomial GAM, interpreting plots HOT 3
- Move all function links to me md syntax [simulateResiduals]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dharma.