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

13,478

Version

0.4.1

License

GPL (>= 3)

Maintainer

Last Published

April 8th, 2021

Functions in DHARMa (0.4.1)

ensureDHARMa

Ensures that an object is of class DHARMa
getSimulations

Get model simulations
getResiduals

Get model residuals
getRandomState

Record and restore a random state
getRefit

Get model refit
plotQQunif

Quantile-quantile plot for a uniform distribution
getQuantile

calculate quantiles
plotConventionalResiduals

Conventional residual plot
getPossibleModels

get possible models
plotResiduals

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

DHARMa standard residual plots
outliers

Return outliers
hist.DHARMa

Histogram of DHARMa residuals
residuals.DHARMa

Return residuals of a DHARMa simulation
print.DHARMa

Print simulated residuals
testOverdispersionParametric

Parametric overdisperstion tests
testPDistribution

Plot distribution of p-values
getFixedEffects

Extract fixed effects of a supported model
getObservedResponse

Get model response
transformQuantiles

Transform quantiles to pdf (deprecated)
testZeroInflation

Tests for zero-inflation
runBenchmarks

Benchmark calculations
testQuantiles

Test for quantiles
testResiduals

DHARMa general residual test
testTemporalAutocorrelation

Test for temporal autocorrelation
testUniformity

Test for overall uniformity
simulateResiduals

Create simulated residuals
recalculateResiduals

Recalculate residuals with grouping
testOutliers

Test for outliers
plot.DHARMa

DHARMa standard residual plots
testCategorical

Test for categorical dependencies
testSimulatedResiduals

Residual tests
testOverdispersion

Simulated overdisperstion tests
testSpatialAutocorrelation

Test for distance-based (spatial, phylogenetic or similar) autocorrelation
testDispersion

DHARMa dispersion tests
plot.DHARMaBenchmark

Plots DHARMa benchmarks
testGeneric

Generic simulation test of a summary statistic
checkDots

Check dot operator
DHARMa.ecdf

Modified ECDF function
DHARMa

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

Check if the fitted model is supported by DHARMa
getFitted

Get fitted / predicted values
ensurePredictor

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

Simulate test data
createDHARMa

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

Check simulated data