Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add offset to <epiparameter>, class methods and helper functions #442

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

joshwlambert
Copy link
Member

This PR adds the functionality for an <epiparameter> object to have a distribution offset. See epiverse-trace/epiparameterDB#24 for addition of offset parameters to the database.

An offset argument is added to create_prob_distribution(), with the offset being stored as a class attribute of the returned object. This avoids the requirement of the distribution object to handle offsets explicitly (for example {distributional} and {distcrete} currently do not handle offsets).

The <epiparameter> distribution functions (density(), cdf(), quantile() and generate()) are updated to use the offset. By default, a zero offset will produce the same behaviour as previous versions.

The <epiparameter> format() and print() methods are updated to print the offset if it is non-zero.

Two unit tests are added that check create_prob_distribution().

This PR also temporarily adds the dependency on {epiparameterDB} from the @offset branch. The dependency will be removed from a specific branch when the Mpox parameters are merged into main in {epiparameterDB}, and the remote dependency will be removed once the new version of {epiparameterDB} is on CRAN.

@joshwlambert joshwlambert added enhancement New feature or request S3-class labels Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

This pull request:

  • Adds 1 new dependencies (direct and indirect)
  • Adds 1 new system dependencies
  • Removes 1 existing dependencies (direct and indirect)
  • Removes 1 existing system dependencies

Reach out on slack (#code-review or #help channels) to double check if there are base R alternatives to the new dependencies.

(Note that results may be inaccurate if you branched from an outdated version of the target branch.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request S3-class
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant