DHARMa

Diagnostics for HierArchical Regression Models

View the Project on GitHub florianhartig/DHARMa

Package support

What DHARMa supports for each regression package, and the checks behind it. Each package folder has a README.md with the support and its limits, and a script (checks.R) whose sections back the statements in the README (some statements cite a GitHub issue instead). The scripts stop with an error if a statement no longer holds, so they can be re-run after changes to DHARMa or to the packages.

The vignette (section “Supported packages and frameworks”) and the package tests (testModelTypes.R, testCompatibility.R) remain the user-facing documentation and the automated tests; these pages give the details and the evidence (see #446).

Overview

Package Model classes Support Main limits
stats, MASS lm, glm, negbin full no quasi families
lme4 lmerMod, glmerMod, lmerModLmerTest; gamm4 via $mer full na.exclude fails (#88, #134)
glmmTMB glmmTMB full no conditioning on selected REs; conditional simulations fall back to unconditional for exp()
mgcv gam, bam full (one linear predictor), partial (several, #600) only conditional simulations; extended families need mgcViz; several linear predictors (#600); multinom, gamm()$gam and gamm4()$gam not supported (#418, #612)
spaMM HLfit full no k/n binomial via weights
GLMMadaptive MixMod partial residuals sorted by the grouping factor; vector predictors must be in this order (#609); beta-binomial with more than one trial requires GLMMadaptive >= 0.9-9 (#565); no Pearson residuals
phylolm phylolm, phyloglm partial residuals in tree tip order; vector predictors must be in this order (#609); poisson_GEE and models fitted in functions fail (#478); no Pearson residuals
brms brmsfit partial (univariate models) weights() ignored (#7); unsupported model types with unclear errors (#612)
phyr   not checked #235
gamlss, VGAM   not supported #319, #322
sjSDM   not supported  
INLA   not supported no simulate() method; workaround: posterior samples with inla.posterior.sample(), response simulated by hand, read in with createDHARMa() (#341, not checked)
censReg, VAST, gjam, rstanarm   not checked #223, #170, #164, #58

Problems that affect several packages:

Running the checks

From the repository root, with the packages of the respective folder installed:

source("Code/DHARMaPackageSupport/lme4/checks.R")

Each script sources supportChecks.R, which loads the current DHARMa (devtools::load_all("DHARMa")) and contains the shared check functions (checkInterface(), refitReproduces(), simulationVariance(), inDataOrder(), …). The scripts run on one core in 5 seconds (stats) to about 9 minutes (glmmTMB).

Conventions