Learn R Programming

⚠️There's a newer version (0.4.7) of this package.Take me there.

DHARMa - Residual Diagnostics for HierARchical Models

The DHARMa package creates readily interpretable residuals for generalized linear (mixed) models that are standardized to values between 0 and 1. This is achieved by a simulation-based approach, similar to the Bayesian p-value or the parametric bootstrap: 1) simulate new data from the fitted model 2) from this simulated data, calculate the cummulative density function 3) residual is the value of the empirical density function at the value of the observed data.

The package includes various functions that deal with issues such as

  • Misfit
  • Overdispersion
  • Zero-inflation
  • Residual temporal autocorrelation
  • Residual spatial autocorrelation

To get more information, install the package and run

library(DHARMa)
?DHARMa
vignette("DHARMa", package="DHARMa")

Copy Link

Version

Install

install.packages('DHARMa')

Monthly Downloads

15,698

Version

0.3.0

License

GPL (>= 3)

Maintainer

Florian Hartig

Last Published

April 20th, 2020

Functions in DHARMa (0.3.0)

getRandomState

Record and restore a random state
hist.DHARMa

Histogram of DHARMa residuals
hasWeigths

Check weights
checkSimulations

Check simulated data
recalculateResiduals

Recalculate residuals with grouping
createDHARMa

Create a DHARMa object from hand-coded simulations or Bayesian posterior predictive simulations
checkDots

Check dot operator
plotSimulatedResiduals

DHARMa standard residual plots
plotQQunif

Quantile-quantile plot for a uniform distribution
testUniformity

Test for overall uniformity
plotResiduals

Generic residual plot with either spline or quantile regression
testTemporalAutocorrelation

Test for temporal autocorrelation
checkModel

Check if the fitted model is supported by DHARMa
print.DHARMa

Print simulated residuals
testResiduals

DHARMa general residual test
testZeroInflation

Tests for zero-inflation
testQuantiles

Test for quantiles
transformQuantiles

Transform quantiles to pdf (deprecated)
getFixedEffects

Extract fixed effects of a supported model
getObservedResponse

Get model response
testGeneric

Generic simulation test of a summary statistic
residuals.DHARMa

Return residuals of a DHARMa simulation
testOverdispersionParametric

Parametric overdisperstion tests
testDispersion

DHARMa dispersion tests
ensurePredictor

Ensures the existence of a valid predictor to plot residuals against
testSimulatedResiduals

Residual tests
getFitted

Get model fitted
getRefit

Get model refit
testPDistribution

Plot distribution of p-values
runBenchmarks

Benchmark calculations
getSimulations

Get model simulations
testOverdispersion

Simulated overdisperstion tests
testOutliers

Test for outliers
simulateResiduals

Create simulated residuals
testSpatialAutocorrelation

Test for spatial autocorrelation
DHARMa.ecdf

Modified ECDF function
createData

Simulate test data
DHARMa

DHARMa - Residual Diagnostics for HierArchical (Multi-level / Mixed) Regression Models
ensureDHARMa

Ensures that an object is of class DHARMa
plotConventionalResiduals

Conventional residual plot
plot.DHARMa

DHARMa standard residual plots
getQuantile

Quantile calculations