florianhartig / DHARMa

Diagnostics for HierArchical Regession Models
http://florianhartig.github.io/DHARMa/
200 stars 21 forks source link

Interpreting DHARMa residuals conditional vs unconditional #380

Closed JonAmon17 closed 1 year ago

JonAmon17 commented 1 year ago

Hello,

I have a question regarding the interpretation of the DHARMa residual plots when looking at unconditional (default) and conditional (re.form = TRUE). I know have been other questions and explanations (vignette etc.) and I tried my best to understand those but I'm still unsure how to interpret my case. As you write, the residuals should look good either way (with unconditional and conditional residuals). In my case, the unconditional residuals look very problematic but are improved a lot when plotted as conditional residuals. What do I make of this? Does that mean that there still is a problem with my model, although it includes the random effects which seem to "fix" this?

My example:

T_LMM <- lmer(Vorjahr19^(1/3) ~ scale(total_N_cnf) * scale(SPEI3_2018_MAM) + scale(DichteKunst) + (1|Height_class) + (1|Standort), data = vars_E,)

Unconditional simulateResiduals(T_LMM, plot = T)

Unconditional (default)

Conditional simulateResiduals(T_LMM, re.form = NULL, plot = T)

With RE (conditional)

Some background information, if helpful: I'm working with growth data of different tree species and investigate how the interaction of drought and nitrogen deposition affects growth. The model I show here is working with the raw data recorded in the field with defined height classes and the different locations as random effects. I have other models from other species which roughly show the behavior when comparing these two plots though this shows the biggest difference. If these models with the raw data don't work, my solution would be to work with averaged data!

It would be much appreciated to get some insight or advice!

florianhartig commented 1 year ago

Hello,

if the residuals look fine conditional on the fitted REs, but not unconditional, I would conclude that something is off with the REs. Have you checked your REs and / or association with predictors?

Best, F

florianhartig commented 1 year ago

I assume the problem is resolved, I‘ll close this. Feel free to re-open in case you have further questions.