Learn R Programming

⚠️There's a newer version (0.4.6) 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

8,327

Version

0.3.3.0

License

GPL (>= 3)

Maintainer

Last Published

September 8th, 2020

Functions in DHARMa (0.3.3.0)

ensurePredictor

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

Simulate test data
DHARMa

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

Get model fitted
createDHARMa

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

Check dot operator
checkModel

Check if the fitted model is supported by DHARMa
checkSimulations

Check simulated data
ensureDHARMa

Ensures that an object is of class DHARMa
DHARMa.ecdf

Modified ECDF function
getFixedEffects

Extract fixed effects of a supported model
getRefit

Get model refit
getObservedResponse

Get model response
hist.DHARMa

Histogram of DHARMa residuals
getSimulations

Get model simulations
testDispersion

DHARMa dispersion tests
testGeneric

Generic simulation test of a summary statistic
plot.DHARMa

DHARMa standard residual plots
plotConventionalResiduals

Conventional residual plot
getQuantile

calculate quantiles
runBenchmarks

Benchmark calculations
outliers

Return outliers
recalculateResiduals

Recalculate residuals with grouping
getRandomState

Record and restore a random state
testSpatialAutocorrelation

Test for spatial autocorrelation
testSimulatedResiduals

Residual tests
simulateResiduals

Create simulated residuals
testUniformity

Test for overall uniformity
testTemporalAutocorrelation

Test for temporal autocorrelation
residuals.DHARMa

Return residuals of a DHARMa simulation
print.DHARMa

Print simulated residuals
plotSimulatedResiduals

DHARMa standard residual plots
testOverdispersionParametric

Parametric overdisperstion tests
testOutliers

Test for outliers
testOverdispersion

Simulated overdisperstion tests
testResiduals

DHARMa general residual test
testQuantiles

Test for quantiles
testZeroInflation

Tests for zero-inflation
testPDistribution

Plot distribution of p-values
plotResiduals

Generic res ~ pred scatter plot with spline or quantile regression on top
plotQQunif

Quantile-quantile plot for a uniform distribution
transformQuantiles

Transform quantiles to pdf (deprecated)