Skip to contents

Thank you for your interest in radEmu! If you use the package and something seems wrong, confusing, or missing, we would love to hear about it. You don’t need to be a programmer or a statistician to contribute, and you don’t need to fix a problem to report it.

radEmu is a statistical package, and people use its results in published research. So changes to the code, especially changes that can affect results, need to be understood and checked before they are merged. A small group of maintainers does that review. This document explains how to make that process as smooth as possible for everyone involved.

The short version

  • Found a bug, or something you don’t understand after reading the documentation and the paper? Open an issue. A clear bug report is one of the most useful contributions you can make.
  • Want to fix it yourself? Great! Say so in the issue. A maintainer will reply, and will let you know how much detail the pull request needs.
  • Fixing a typo or a broken link? Go ahead and open a pull request directly.
  • Changing code that affects estimates, test statistics, or p-values? Please read Changes that affect results below. These changes need the most evidence.
  • Planning a contribution? Open an issue first. We’re a small team, and reviewing a change takes us much longer than writing one, so we prioritize fixes for bugs that users run into and features that users have asked for. See Review and closing policy for details.

Reporting a bug

Please use the bug report issue template. The most helpful reports include:

  • a small example that shows the problem, using simulated or public data. The reprex package makes this easy, but any code we can run is helpful.
  • what you expected to happen and what actually happened
  • anything unusual about your setup, if you know it (e.g., design matrix structure, number of categories J, non-default arguments)
  • the output of sessionInfo() and packageVersion("radEmu"), if you can

If you can’t provide all of this, please open the issue anyway. We would rather hear about a problem than not.

Pull requests

Open an issue first

For anything beyond a trivial change, open an issue and wait for a maintainer to respond before you submit a pull request. Agreeing on the problem first saves everyone time: we may already be working on it, or we may want to solve it in a different way. The issue discussion is also where we will tell you what the pull request needs, so you don’t have to guess.

Trivial changes do not need an issue. These include:

  • typos and grammar fixes in documentation or comments
  • broken links
  • small clarifications to documentation that do not change described behavior

Bug fixes, new features, changes to defaults, refactoring, and performance work should all start with an issue.

What every pull request needs

Please fill out the pull request template. Scale the detail to the change: a typo fix needs a sentence, and a one-line fix that changes p-values deserves a full explanation. At a minimum:

  1. A linked issue (unless the change is trivial).
  2. What the change does and why, in your own words.
  3. A test that fails without your change and passes with it, for bug fixes and behavior changes. A short comment saying what it checks, with a link to the issue, is enough.
  4. A NEWS.md entry for any user-visible change. Add it under the development version heading at the top.

Keep pull requests focused. One problem per pull request is much easier to review than several unrelated changes bundled together.

Changes that affect results

Changes to estimates, test statistics, p-values, or other numerical results get the most careful review, because they change what users report in their research. The goal is that a reviewer who knows radEmu, but not your problem, can see what the change does, why it is needed, and why it is correct, without having to reconstruct any of it.

For these changes, please include the following, in addition to everything above.

In the pull request description

  • What goes wrong. Under what settings, and what the user sees.
  • The cause, explained. Say why the code does the wrong thing, not just that it does: what the code actually computes, and what it should compute instead. For example: “this function enforces a different null hypothesis than the one being tested, because it ignores the user’s constraint_param.”
  • A walkthrough of the code, with links. Point reviewers to the lines that matter: where the problem comes from, how it reaches the user, and where your change fixes it. Use permalinks, which link to a specific commit rather than a branch, so line numbers stay correct as the code changes. On GitHub, press y on a file page, or choose “Copy permalink” from the menu next to a selected line.
  • Evidence. Show output from before and after the change on a reproducible example; a small before/after table is often clearest. Include results under default settings so reviewers can see whether they change. Compare against an independent reference, such as an alternative algorithm in the package, a closed-form result, or a simulation. “The tests pass” is not, on its own, evidence that a statistical change is correct.
  • Scope. Note anything else the change could affect, and whether default behavior changes.

In the code

Explanations in the pull request help the reviewer. Explanations in the code help whoever reads it next, after the pull request is merged.

  • A documented test. Someone who sees the test fail should be able to tell from the comments what broke. A short header may be appropriate, for example:

    # Regression test for #123.
    #
    # Bug: <what went wrong, and why>.
    # Setup: <why this data shows the problem>.
    # Checks: <what each assertion verifies>.
    test_that("...", {

    Say where any hard-coded numbers and tolerances come from.

  • Comments that explain why for non-obvious code, especially code that looks like it could be simplified but can’t be. Keep the history (how the bug was found) in the pull request, and keep the reason in the code.

Development workflow

  • Documentation is generated with roxygen2. Edit the roxygen comments in R/, then run devtools::document(). Do not edit files in man/ by hand.
  • Run the tests with devtools::test(). You can run a subset with, e.g., devtools::test(filter = "score_test").
  • Run devtools::check() before submitting, and make sure it passes without new errors, warnings, or notes.
  • R code is formatted with Air. Run air format . from the package root to format everything, or use Air’s editor integration. To catch unformatted code before it is committed, enable the pre-commit hook once per clone with git config core.hooksPath .githooks. Pull requests run the same check in CI.
  • Formatting-only commits are listed in .git-blame-ignore-revs. GitHub’s blame view skips it automatically. To make git blame skip it locally too, run git config blame.ignoreRevsFile .git-blame-ignore-revs once per clone.

If any of this is unfamiliar, say so in your issue or pull request and we can help.

Use of AI tools

You may use AI tools (code assistants, chat models, etc.) when contributing. We care about the quality of the contribution and the accountability of the contributor, not about which tools were used. The following rules apply:

  • You are the author of record. The person who opens a pull request is accountable for every line in it, however it was produced. “The AI wrote it” is not an acceptable answer to a review question.
  • You must understand and have run the code. Do not submit changes you cannot explain, or that you have not run yourself.
  • Disclose AI use in the pull request template. This helps reviewers calibrate their review; it does not count against your contribution.
  • The standards above apply in full. Issue-first, motivation, and evidence matter most for AI-assisted changes, because generating plausible-looking code is cheap and verifying it is not.

We do not require AI tools to be credited as co-authors in commit messages (e.g., with Co-authored-by: trailers), though we do not prohibit it either.

Licensing

radEmu is released under the MIT License. By submitting a contribution, you certify that you have the right to submit it under this license. You are responsible for making sure your contribution does not include material you do not have the right to contribute, such as code copied from projects with incompatible licenses.

Review and closing policy

Maintainers review contributions as time allows. We prioritize contributions from people who use radEmu and have discussed their change with us in an issue. To keep review sustainable, maintainers may close pull requests without review if they:

  • skip or substantially ignore the pull request template,
  • make non-trivial changes without a linked issue, or
  • change numerical results without the explanation and evidence described above.

Closing a pull request is not a judgment of you or of the idea. You are welcome to open an issue to discuss it, and to resubmit once the pull request meets these guidelines.

Thank you for helping make radEmu better!