Multilevel Logistic Regression in ESM - Psychology/ Substance Use Research

Context

  • Data: experience-sampling (ESM) study in psychology/behavioural science
  • Outcome (C_t1): binary (1 = use; 0 = no use)
  • Predictors: continuous within-person variables (PA_t0, NA_t0) plus time-gap and a baseline frequency covariate.
  • Model: multilevel (random-intercept) logistic regression with lme4::glmer().

library(lme4)

model_PA <- glmer(
C_t1 ~ PA_t0 + max_use_days + minutes_until_next_use + (1 | id),
data = df_model_vars,
family = binomial,
control = glmerControl(optimizer = "bobyqa",
optCtrl = list(maxfun = 1e5))
)

### What I’ve done so far:

  • Checked multicollinearity (car::vif() → all VIF ≈ 1)
  • Calculated ICC (≈ 0.21) to justify the random intercept
  • Ran performance::check_overdispersion() – reports under-dispersion (ratio ≈ 0.78)
  • Read that DHARMa can test residual uniformity, dispersion, outliers, and temporal autocorrelation, but I’m unfamiliar with it. (!!!)

DHARMA Example

library(DHARMa)

set.seed(123)
sim_PA <- simulateResiduals(model_PA, n = 5000)

plot(sim_PA) # four-panel check
testDispersion(sim_PA) # dispersion p-value
testUniformity(sim_PA) # KS test
testOutliers(sim_PA) # extreme residuals

My questions:

  1. Is DHARMa the right tool for diagnosing a two-level logistic GLMM like this?
  2. If yes, which DHARMa tests / plots are essential, and how should I interpret under-dispersion when a random intercept is already in the model?
  3. Do you have published examples (ESM / EMA papers) that use DHARMa for similar models? Seeing precedent would help me justify it to co-authors and reviewers.
    I've found this one: https://pmc.ncbi.nlm.nih.gov/articles/PMC11871378/#jora70009-sec-0007

Where I read about Dharma: DHARMa: residual diagnostics for hierarchical (multi-level/mixed) regression models

EDIT 2:
I found this paper: https://www.researchgate.net/publication/263352347_Fitting_Linear_Mixed-Effects_Models_Using_lme4

Thank you,
Ana