Diagnostics for HierArchical Regression Models
Contributions to DHARMa are welcome! This document describes how to contribute effectively and what to expect from the process. Tasks of the DHARMa team (maintainers and collaborators with write access to this repository), such as preparing a CRAN release, are described in Maintaining DHARMa.
DHARMa is open-source software, and in the spirit of open source, questions and answers should be public, so that other people can profit from them as well. Please ask questions, report problems and suggest features on the DHARMa issue tracker, after searching the existing issues. Alternatively, you can post on Cross Validated and e-mail the link to the maintainer, who can then comment there. If you have concerns posting to a public forum, you can also write to the maintainer by e-mail (run maintainer("DHARMa") in R to get the address).
It is easier to help you if your question is well structured. Typically, it contains:
sessionInfo(),For problems and errors, please always include a minimal reproducible example: code that runs as is in a fresh R session and shows the problem. See How to make a great R reproducible example and the reprex package. Use data that everyone can access, if possible: a dataset that comes with R or a package (e.g., data(mtcars)), simulated data (e.g., with DHARMa::createData()), or a small or randomized part of your data pasted into the example with dput(head(myData, 30)). If you do not want to share your data in public, create the example in public and send the data privately by e-mail. Problem reports without a reproducible example may be closed.
Please write issues so that they are understandable without earlier discussions. If you have already diagnosed the problem or have ideas for a fix, including that analysis is very helpful. You are also welcome to comment on existing issues, for example by adding examples or proposing solutions.
Please open or comment on an issue before you start working on a pull request, so that the approach can be discussed before you invest time in an implementation. This avoids situations where a pull request cannot be merged because of design conflicts that could have been resolved earlier. Only trivial fixes (e.g., typos or a factual error in the documentation) can go directly to a pull request. See Pull request workflow below.
When working on changes, note that there is extensive code for tests and development purposes outside the package in the folder Code/ of this repository (see the README there for its structure). You may find useful context there. Changes to Code/ follow the same workflow.
If you would like DHARMa to support a further R package or model class, see Adding support for new R packages.
This policy applies to contributors outside the DHARMa team; only the disclosure of AI use (last paragraph) applies to everyone.
Issues, pull requests and comments created autonomously by AI agents or automated tools will not be accepted. They will be closed or deleted without review.
The maintainer must be able to understand, evaluate, and take long-term responsibility for every change integrated into DHARMa. AI-generated code frequently appears correct but introduces subtle errors that are difficult to detect without deep familiarity with the codebase, and the burden of reviewing such contributions falls disproportionately on the maintainer. For a scientific package where correctness is critical, this risk is not acceptable.
This policy covers issues, pull requests and comments submitted autonomously by AI agents, as well as contributions where the submitter does not have a full, independent understanding of the proposed changes. Having a tool post a contribution at your explicit request, after you have checked its content, does not count as autonomous.
Using AI tools as a personal aid during development is a matter of individual choice. However, any contribution must be authored and understood by a human who can explain, defend, and iterate on the proposed changes.
If you are unsure whether your contribution complies with this policy, ask yourself: can you explain every line of your proposed change and its consequences for the rest of the codebase? If not, please do not submit it as a pull request — an issue describing the problem or idea is a better starting point.
For everyone, including the DHARMa team: if AI tools wrote substantial parts of your code or text, please mention this briefly in your issue, pull request, comment or commit (one sentence is enough, e.g., “Code drafted with an AI assistant, checked and tested by me.”; in commits, use a trailer such as Assisted-by: <tool> (<model>)). Instructions for AI coding agents, including those used by the DHARMa team, are in AGENTS.md.
master is the development branch; CRAN releases are tagged on master (e.g., v0.5.0). There are no separate development or release branches, except a short-lived branch v<version>-cranSubmission for each CRAN submission (see the CRAN submission checklist).
master and name it as follows, with - as separator and <shortName> in lowerCamelCase:
i<issue number>-<shortName>, e.g., i562-jitterPoints.v<release>-<shortName>, e.g., v0.5.1-docFixes.<shortName>, e.g., fixTypoVignette.v0.5.1).master. Do not split one issue across several pull requests; follow-up work gets a new issue.Fixes #351 or Closes #351 (with your issue number) in its description or commit message, so that GitHub closes the issue automatically when it is merged into master. For several issues, repeat the keyword for each, e.g., Fixes #567, fixes #568.DHARMa/. Please follow the existing code style and conventions:
get (e.g., getSimulations, getResiduals).# fixes #538 (restore simcodes of model object). Use such comments sparingly, typically in one or two places per issue.DHARMa/man/ are generated from it; do not edit them by hand, but run devtools::document("DHARMa") from the repository root.test*.R file in DHARMa/tests/testthat/. Tests should check behavior that matters, not cosmetic details. Tests of specific cases that are not part of R CMD check go into Code/DHARMaTests/ (see the README there).DHARMa/NEWS.md under the topmost version heading for every user-visible change (no entry for bugs introduced after the last release), ending with the issue or pull request number(s) if there are any, e.g., * Small output fixes in `testCategorical()`, `testOutliers()` and `print.DHARMa` (#569).. For substantial contributions from outside the DHARMa team (see Attribution and authorship), add the author’s GitHub username first, e.g., (@BertvanderVeen, #535).R CMD check runs on pull requests to master (GitHub Actions; for first-time contributors after approval by the DHARMa team) and must pass. Locally, it is usually sufficient to run the tests related to your change, e.g., testthat::test_file("DHARMa/tests/testthat/testTests.R") after devtools::load_all("DHARMa").Contributors who make substantial contributions to DHARMa will be acknowledged by name in the README and/or the NEWS.md file. Substantial contributions include, but are not limited to: implementing support for a new model class, adding a meaningful new function or test, identifying and fixing a non-trivial bug, or making significant improvements to the documentation or vignette.
Minor corrections such as fixing typos, correcting punctuation, or making small formatting adjustments do not typically result in named acknowledgement, as is standard in open-source scientific software. If you are uncertain whether a planned contribution would qualify, you are welcome to ask in the relevant issue.