-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve access to <distribution>
names
#398
Conversation
The improvements in the PR have also fixed a previously unknown bug when discretising Here is a reprex using code from the library(epiparameter)
ep = epiparameter(
disease = "Disease",
epi_name = "SI",
prob_distribution = create_prob_distribution(
prob_distribution = "lnorm",
prob_distribution_params = c(meanlog = 2, sdlog = 2),
truncation = 10)
)
#> Citation cannot be created as author, year, journal or title is missing
discretise(ep)
#> Warning: Discretising a truncated continuous distribution, returning
#> non-truncated discretised distribution
#> Error: Invalid parameterisation for lognormal distribution Created on 2024-10-21 with reprex v2.1.0 Here is a reprex using code from the library(epiparameter)
ep = epiparameter(
disease = "Disease",
epi_name = "SI",
prob_distribution = create_prob_distribution(
prob_distribution = "lnorm",
prob_distribution_params = c(meanlog = 2, sdlog = 2),
truncation = 10)
)
#> Citation cannot be created as author, year, journal or title is missing
discretise(ep)
#> Warning: Discretising a truncated continuous distribution, returning
#> non-truncated discretised distribution
#> Disease: Disease
#> Pathogen: NA
#> Epi Parameter: si
#> Study: (????). "No citation."
#> Distribution: discrete lnorm
#> Parameters:
#> meanlog: 2.000
#> sdlog: 2.000 Created on 2024-10-21 with reprex v2.1.0 |
This PR improves the access to distribution names in
<distribution>
objects from the {distributional} package by replacing the.get_mixture_dist()
function with the more general.distributional_family()
and enhancingfamily.epiparameter()
.Using the new version of the
<epiparameter>
family()
method, calls tostats::family()
have been removed from the package, andis_truncated()
has been simplified (#274).The PR improves functions that were manually extracting the information from
<distribution>
objects by having to subset objects several times (e.g.discretise.epiparameter()
) by now calling.distributional_family()
.New tests are added for
family.epiparameter()
and.distributional_family()
.