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")

Acknowledgements

A question by Catalina Gutiérrez Chacón provided me with the motivation write the first version of DHARMa. Thanks to Jochen Fründ, Tomer J. Czaczkes, Luis Cayuela Delgado and Alexandre Courtiol for useful suggestions to improve the software.

Copy Link

Version

Install

install.packages('DHARMa')

Monthly Downloads

15,698

Version

0.1.6

License

GPL (>= 3)

Maintainer

Florian Hartig

Last Published

March 18th, 2018

Functions in DHARMa (0.1.6)

benchmarkOverdispersion

Overdispersion benchmarks
fitted.gam

This function overwrites the standard fitted function for GAM
plotQQunif

Quantile-quantile plot for a uniform distribution
plot.DHARMa

Plot simulated residuals
plotConventionalResiduals

Conventional residual plot
benchmarkP

General Type I/II benchmarks
print.DHARMa

Print simulated residuals
testPDistribution

Plot distribution of p-values
benchmarkUniformity

Uniformity benchmarks
createDHARMa

Convert simulated residuals or posterior predictive simulations to a DHARMa object
testSimulatedResiduals

Residual tests
simulateResiduals

Create simulated residuals
DHARMa

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

Test for overall uniformity
plotSimulatedResiduals

DHARMa standard residual plots
createData

Simulate test data
testOverdispersion

Test for over/underdispersion
testTemporalAutocorrelation

Test for temporal autocorrelation
testSpatialAutocorrelation

Test for spatial autocorrelation
testZeroInflation

Tests for zero-inflation
testOverdispersionParametric

Parametric overdispersion test
plotResiduals

Generic residual plot with either spline or quantile regression