Add offset to <epiparameter>
, class methods and helper functions
#442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the functionality for an
<epiparameter>
object to have a distribution offset. See epiverse-trace/epiparameterDB#24 for addition ofoffset
parameters to the database.An
offset
argument is added tocreate_prob_distribution()
, with theoffset
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()
andgenerate()
) are updated to use the offset. By default, a zero offset will produce the same behaviour as previous versions.The
<epiparameter>
format()
andprint()
methods are updated to print theoffset
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 intomain
in {epiparameterDB}, and the remote dependency will be removed once the new version of {epiparameterDB} is on CRAN.