You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: dist_spec() in the @dist-interface branch still works for "lognormal" but does not for "gamma".
Description:
The new dist-interface in #504 nicely provides a safer interface than dist_spec(), in the input and in the output.
In the input, for lognormal distributions, this prevents the misspecification of summary statistics values to arguments like mean and sd that need distribution parameters meanlog and sdlog instead, as reported in the intended to fix issue.
The output is also informative because now we get a detailed list of distribution parameters, compared with the previous Fixed distribution with PMF [...] output. This was informative to identify this misspecification in a previous comment.
Although deprecated, we can still use dist_spec() which is nice for reproducibility purposes. This is working nicely for "lognormal". However, when running dist_spec() for "gamma" distributions we get an error.
Reproducible Steps:
This code below is reproducible using the current dev-version and the dist-interface
library(EpiNow2)
#> #> Attaching package: 'EpiNow2'#> The following object is masked from 'package:stats':#> #> Gamma# lognormal ---------------------------------------------------------------
LogNormal(
meanlog=1.5,
sdlog=1,
max=14
)
#> - lognormal distribution (max: 14):#> meanlog:#> 1.5#> sdlog:#> 1
dist_spec(
mean=1.5,
sd=1,
max=14, # optional for epinow2@dist-interfacedistribution="lognormal"
)
#> Warning: `dist_spec()` was deprecated in EpiNow2 1.5.0.#> ℹ Please use distribution functions such as `Gamma()` or `Lognormal()` instead.#> ℹ The function will become internal only in version 2.0.0.#> This warning is displayed once every 8 hours.#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was#> generated.#> - lognormal distribution (max: 14):#> meanlog:#> - fixed value:#> 1.5#> sdlog:#> - fixed value:#> 1# gamma -------------------------------------------------------------------
Gamma(
mean=3,
sd=1,
max=14, # optional for epinow2@dist-interface
)
#> - gamma distribution (max: 14):#> shape:#> 9#> rate:#> 3
dist_spec(
mean=3,
sd=1,
max=14, # optional for epinow2@dist-interfacedistribution="gamma"
)
#> Error in names(parameters) <- natural_params(distribution): 'names' attribute [2] must be the same length as the vector [0]
EpiNow2 Version:
reprex created with remotes::install_github("epiforecasts/EpiNow2@dist-interface") in a renv-isolated project. As noted above, this reprex also runs with the current dev-version.
EDIT: replaced reprex with EpiNow2 code only plus comparing previous and coming interface
The text was updated successfully, but these errors were encountered:
Summary:
dist_spec()
in the@dist-interface
branch still works for "lognormal" but does not for "gamma".Description:
The new dist-interface in #504 nicely provides a safer interface than
dist_spec()
, in the input and in the output.mean
andsd
that need distribution parametersmeanlog
andsdlog
instead, as reported in the intended to fix issue.Fixed distribution with PMF [...]
output. This was informative to identify this misspecification in a previous comment.Although deprecated, we can still use
dist_spec()
which is nice for reproducibility purposes. This is working nicely for "lognormal". However, when runningdist_spec()
for "gamma" distributions we get an error.Reproducible Steps:
This code below is reproducible using the current dev-version and the dist-interface
Created on 2024-02-29 with reprex v2.1.0
EpiNow2 Version:
reprex created with
remotes::install_github("epiforecasts/EpiNow2@dist-interface")
in a renv-isolated project. As noted above, this reprex also runs with the current dev-version.EDIT: replaced reprex with EpiNow2 code only plus comparing previous and coming interface
The text was updated successfully, but these errors were encountered: