Package: DHARMa 0.5.0

Florian Hartig

DHARMa: Residual Diagnostics for Hierarchical (Multi-Level / Mixed) Regression Models

"Uses a simulation-based approach to create readily interpretable scaled (quantile) residuals for fitted generalized linear (mixed) models. Currently supported are linear and generalized linear (mixed) models from 'lme4' (classes 'lmerMod', 'glmerMod'), 'glmmTMB', 'GLMMadaptive', 'spaMM', and 'brms' (simple models); phylogenetic linear models from 'phylolm' (classes 'phylolm' and 'phyloglm'); generalized additive models ('gam' from 'mgcv'); 'glm' (including 'negbin' from 'MASS', but excluding quasi-distributions) and 'lm' model classes. Moreover, externally created simulations, e.g. posterior predictive simulations from Bayesian software such as 'JAGS', 'STAN', or 'BUGS' can be processed as well. The resulting residuals are standardized to values between 0 and 1 and can be interpreted as intuitively as residuals from a linear regression. The package also provides a number of plot and test functions for typical model misspecification problems, such as over/underdispersion, zero-inflation, and residual spatial, temporal and phylogenetic autocorrelation."

Authors:Florian Hartig [aut, cre], Lukas Lohse [ctb], Melina de Souza Leite [ctb], Cosmina Werneke [ctb]

DHARMa_0.5.0.tar.gz
DHARMa_0.5.0.zip(r-4.7)DHARMa_0.5.0.zip(r-4.6)DHARMa_0.5.0.zip(r-4.5)
DHARMa_0.5.0.tgz(r-4.6-any)DHARMa_0.5.0.tgz(r-4.5-any)
DHARMa_0.5.0.tar.gz(r-4.7-any)DHARMa_0.5.0.tar.gz(r-4.6-any)
DHARMa_0.5.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
DHARMa/json (API)
NEWS

# Install 'DHARMa' in R:
install.packages('DHARMa', repos = c('https://staffanbetner.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/florianhartig/dharma/issues

Datasets:

On CRAN:

Conda:

glmmregressionregression-diagnosticsresidual

15.63 score 259 stars 19 packages 4.4k scripts 28k downloads 194 mentions 40 exports 93 dependencies

Last updated from:948ccf5402. Checks:1 ERROR, 8 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-x86_64ERROR422
source / vignettesOK271
linux-release-x86_64OK282
macos-release-arm64OK183
macos-oldrel-arm64OK114
windows-develOK303
windows-releaseOK229
windows-oldrelOK214
wasm-releaseOK184

Exports:benchmarkRuntimecreateDatacreateDHARMagetDatagetFamilygetFittedgetFixedEffectsgetObservedResponsegetPearsonResidualsgetPredictorNamesgetQuantilegetRandomStategetRefitgetResidualsgetSimulationsoutliersplotConventionalResidualsplotQQunifplotResidualsplotResidualsAllplotSimulatedResidualsrecalculateResidualsrunBenchmarkssimulateLRTsimulateResidualstestCategoricaltestDispersiontestGenerictestOutlierstestOverdispersiontestOverdispersionParametrictestPhylogeneticAutocorrelationtestQuantilestestResidualstestSimulatedResidualstestSpatialAutocorrelationtestTemporalAutocorrelationtestUniformitytestZeroInflationtransformQuantiles

Dependencies:apeaskpassbase64encbootbslibcachemclicodetoolscommonmarkcpp11crosstalkcurldata.tabledigestdoParalleldplyrevaluatefarverfastmapfontawesomeforeachfsgapgap.datasetsgenericsggplot2gluegtablehighrhtmltoolshtmlwidgetshttpuvhttrisobanditeratorsjquerylibjsonliteknitrlabelinglaterlatticelazyevallifecyclelme4lmtestmagrittrMASSMatrixmemoisemgcvmimeminqanlmenloptropensslotelpillarpkgconfigplotlyplyrpromisespurrrqgamR6rappdirsrbibutilsRColorBrewerRcppRcppEigenRdpackreformulasrlangrmarkdownS7sassscalesshinysourcetoolsstringistringrsystibbletidyrtidyselecttinytexutf8vctrsviridisLitewithrxfunxtableyamlzoo

DHARMa for Bayesians

Rendered fromDHARMaForBayesians.Rmdusingknitr::rmarkdownon May 28 2026.

Last update: 2026-05-12
Started: 2021-01-26

DHARMa: residual diagnostics for hierarchical (multi-level/mixed) regression models

Rendered fromDHARMa.Rmdusingknitr::rmarkdownon May 28 2026.

Last update: 2026-05-28
Started: 2016-08-11

Readme and manuals

Help Manual

Help pageTopics
DHARMa: Residual Diagnostics for Hierarchical (Multi-Level / Mixed) Regression ModelsDHARMa-package DHARMa
Benchmark runtimes of several functionsbenchmarkRuntime
Simulate test datacreateData
Create a DHARMa object from hand-coded simulations or Bayesian posterior predictive simulations.createDHARMa
Get model datagetData getData.brmsfit getData.default getData.merMod
Get model familygetFamily getFamily.default getFamily.phyloglm getFamily.phylolm
Get fitted/predicted valuesgetFitted getFitted.brmsfit getFitted.default getFitted.gam getFitted.HLfit getFitted.MixMod getFitted.phyloglm getFitted.phylolm
Extract fixed effects of a supported modelgetFixedEffects getFixedEffects.brmsfit getFixedEffects.default getFixedEffects.MixMod
Get model responsegetObservedResponse getObservedResponse.default getObservedResponse.HLfit getObservedResponse.phyloglm getObservedResponse.phylolm
Get Pearson residualsgetPearsonResiduals getPearsonResiduals.brms getPearsonResiduals.default getPearsonResiduals.gam
Get predictor namesgetPredictorNames getPredictorNames.default getPredictorNames.MixMod
Calculate Residual QuantilesgetQuantile
Record and restore a random stategetRandomState
Get model refitgetRefit getRefit.brmsfit getRefit.default getRefit.glmmTMB getRefit.HLfit getRefit.lm getRefit.MixMod getRefit.phyloglm getRefit.phylolm
Get model residualsgetResiduals getResiduals.brmsfit getResiduals.default getResiduals.MixMod
Get model simulationsgetSimulations getSimulations.brmsfit getSimulations.default getSimulations.gam getSimulations.glmmTMB getSimulations.HLfit getSimulations.merMod getSimulations.MixMod getSimulations.negbin getSimulations.phyloglm getSimulations.phylolm
Histogram of DHARMa residualshist.DHARMa
Hurricaneshurricanes
Return outliersoutliers
DHARMa standard residual plotsplot.DHARMa
Plots DHARMa benchmarksplot.DHARMaBenchmark
Conventional residual plotplotConventionalResiduals
Quantile-quantile plot for a uniform distributionplotQQunif
Generic res ~ pred scatter plot with spline or quantile regression on topplotResiduals
Create multiple residual plots simultaneously.plotResidualsAll
DHARMa standard residual plots (deprecated)plotSimulatedResiduals
Print simulated residualsprint.DHARMa
Recalculate residuals with groupingrecalculateResiduals
Return residuals of a DHARMa simulationresiduals.DHARMa
Benchmark calculationsrunBenchmarks
Simulated likelihood ratio tests for (generalized) linear mixed modelssimulateLRT
Create simulated residualssimulateResiduals
Test for categorical dependenciestestCategorical
DHARMa dispersion teststestDispersion
Test for a generic summary statistic based on simulated datatestGeneric
Test for outlierstestOutliers
Simulated overdisperstion tests (deprecated)testOverdispersion
Parametric overdisperstion tests (deprecated)testOverdispersionParametric
Plot distribution of p-values.testPDistribution
Test for phylogenetic autocorrelationtestPhylogeneticAutocorrelation
Test for quantilestestQuantiles
DHARMa general residual testtestResiduals
Residual teststestSimulatedResiduals
Test for distance-based spatial (or similar type) autocorrelationtestSpatialAutocorrelation
Test for temporal autocorrelationtestTemporalAutocorrelation
Test for overall uniformitytestUniformity
Tests for zero-inflationtestZeroInflation
Transform quantiles to pdf (deprecated)transformQuantiles