Skip to content

Instantly share code, notes, and snippets.

@jim-rafferty
jim-rafferty / ZINB_DHARMa_example.r
Created May 30, 2024 10:06
Creating a DHARMa object to test model residuals for a ZINB model that isn't supported by DHARMa::simulateResiduals
# Downlad data
download.file("https://github.com/cran/pscl/raw/master/vignettes/DebTrivedi.rda", destfile = "DebTrivedi.rda")
load(file="DebTrivedi.rda")
df = DebTrivedi[, c(1, 6:8, 13, 15, 18)]
# this is some data about the number of outpatient appointments attended by
# people in the US (it's from the pscl vignette)
# it doesn't really matter what this data is, just that it has a zero
# inflated count outcome.