Stochastic Scenario Analysis Tool

Background

Scenario analysis is a typical use case for infectious disease modelling - given what we think is going on, if we do X, how will it turn out compared to Y? Stochastic models are also a typical application - given a mix of uncertainty / chance whats going on, what’s the range of how things turn out?

When these two simulation activities are combined, there are some pitfalls. Those pitfalls are analogous (in a precise, not just illustrative) to the problems that can emerge in typical epidemiological studies. Briefly, they result from poor matching between control and treatment populations. This is addressable by fine control of the use of random numbers. However, such control can be quite complicated / computationally expensive, and its not always clear what level of control is appropriate.

Proposal

Some folks have been doing work on an approach to simplify the implementation of finer control, alongside highlighting how to think more clearly and explicitly about model choices and their implications. Currently at GitHub - pearsonca/hbmPRNG: Hash-based Matching Pseudo-Random Number Generation.

What do people think about pulling that approach implementation under the epinowcast banner?

I think its a nice solving-general-epi-modelling tool (pro), but its not really (at least yet) about real-time, “*casting” analyses (con).

3 Likes

Update: this is now a more refined tool at GitHub - epinowcast/hashprng at master (soon to be merged into main branch). You can roughly:

library(hashprng)
set.salt(42) # set.salt works analogously to set.seed, when hash-matching
runif(10, hash = list(1, 2, 3))
runif(10, hash = list(1, 2, 3)) # same result
runif(10, hash = list(3, 2, 1)) # different result
set.salt("this works too")
runif(10, hash = list(1, 2, 3)) # no longer the same

If y’all have a chance, please try it out and let me know what you think - interface-wise, performance-wise, explanation, etc, etc. The vignette is a reasonable starting place.

1 Like