Closed pratikunterwegs closed 2 months ago
This issue is a candidate for closing: the implementation of stats::rmultinom()
is a very efficient way of drawing from a weighted categorical distribution, written in C; it cannot easily be improved by re-writing in Rcpp. This has been added to the design principles vignette.
This issue requests a second attempt at an implementation of the ebola model. The previous Rcpp implementation was removed in #140, as it did not offer a substantial speed gain.
Possible reasons for no speed gain, and possible targets for improvement:
prob_discrete_erlang()
could be made more efficient;stats::multinomial()
for a single draw could be replaced with a function wrappingsample()
or with a custom weighted lottery function; see e.g. this implemenation in {pathomove};if-else
?)Note: make sure to use Rcpp-provided random number draws, or to include a wrapper to the R random number generator to take advantage of seed management through R.