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
This is an unlikely, and epidemiologically nonsensical, use case, but when running bpmodels::chain_sim() with $R = 0$ and $k = 0$ then the function fails with an unfriendly error message.
bpmodels::chain_sim(n=10, offspring="nbinom", stat="size", mu=0, size=0)
#> Warning in get(roffspring_name)(n = sum(n_offspring[sim]), ...): NAs produced#> Error in if (any(next_gen%%1 > 0)) {: missing value where TRUE/FALSE needed
Thanks for reporting, Josh. I will add a quick check here for negative binomial parameters as we discussed in person but as noted in the README, we have transitioned all features of bpmodels to the epichains package, which we strongly recommend that users use moving forward.
For example, running the same thing with {epichains} yields this error which could potentially be improved in not clear.
library(epichains)
epichains::simulate_chain_stats(
n_chains=10,
offspring_dist=rnbinom,
statistic="size",
mu=0,
size=0
)
#> Warning in (function (n, size, prob, mu) : NAs produced#> Error in .sample_possible_offspring(offspring_func = offspring_dist, offspring_func_pars = pars, : Offspring distribution must return integers
This is an unlikely, and epidemiologically nonsensical, use case, but when running$R = 0$ and $k = 0$ then the function fails with an unfriendly error message.
bpmodels::chain_sim()
withCreated on 2024-08-22 with reprex v2.1.0
It would be good to catch this with an input check.
The text was updated successfully, but these errors were encountered: