epiverse-trace / epidemics

A library of published compartmental epidemic models, and classes to represent demographic structure, non-pharmaceutical interventions, and vaccination regimes, to compose epidemic scenarios.
https://epiverse-trace.github.io/epidemics/
Other
8 stars 2 forks source link

Add vignette to compare with {finalsize} #33

Closed pratikunterwegs closed 10 months ago

pratikunterwegs commented 1 year ago

This PR is to request a vignette that compares the final size calculations from {epidemics} against those from {finalsize}, to show the effect of implementing interventions and vaccination regimes.

BlackEdder commented 11 months ago

WIP: https://github.com/epiverse-trace/epidemics/tree/finalsize_vignette

BlackEdder commented 11 months ago

The vignette includes a couple of simple code examples to compare the two approaches. I noticed a couple of differences in the implementation that might be good to think about.

adamkucharski commented 11 months ago

Have had a look through, and useful to see them side-by-side to understand structure/naming etc. A few additional thoughts:

pratikunterwegs commented 11 months ago

The vignette includes a couple of simple code examples to compare the two approaches. I noticed a couple of differences in the implementation that might be good to think about.

Thanks @BlackEdder, will you keep working on this vignette or should I take this further and make a PR?

There are some naming differences, particularly demo_grp vs demography_group

Thanks - maybe 'demo_group' is a good compromise between the two packages, and between clarity and brevity. That said {finalsize} is on CRAN so perhaps adopting 'demo_grp' in {epidemics} is safer than changing it in both packages.

The form of the contact matrix used is different in both packages. For SEIR-V it is not needed to rescale the contact matrix, presumably because it does so internally. In finalsize this is needed. Would be good if we can think of a way to unify this.

Yes, it is scaled internally using .prepare_args_default(). This could be a good time to take another look at the {contactmatrix} package we had been discussing?

Is there a general way to know the proportion of the population vaccinated in the vaccine calendar? It did not seem to be equal to nu times the number of days the vaccination programme is happening?

I had not really thought about it, but I can convert it to an issue and a relevant test for correctness.

pratikunterwegs commented 11 months ago

Have had a look through, and useful to see them side-by-side to understand structure/naming etc. A few additional thoughts:

If including as vignette, would be good to distinguish what it adds beyond the existing compartmental comparison in finalsize.

Perhaps an obvious one is alignment in how different aspects are defined. Perhaps too much refactoring to get full alignment, would be nice if possible to unify parameters so easier to use in the other model.

Another would be the difference in speed, particularly if sampling over many realisations of R0 (as discussed in finalsize and issue accepts R as a distribution or samples #106)

There's also quite a lot of wrangling code required to compare, so could be useful to have this vignette as more of a guide to help users decide which is preferable, e.g. if you want to easily calculate overall size, and do multiple realisations, finalsize gets you there much faster and potentially more accurately, because it's based on analytical solution. Whereas any temporal questions have to be addressed with epidemics?

Thanks @adamkucharski - I think being able to answer the temporal questions, and the effect of interventions etc is probably the key aspect, but others are good to mention too.

Speaking of temporal questions, would it be useful to have helper functions that help get the timing and size of the epidemic peak (optionally by age group)?

adamkucharski commented 11 months ago

Yep, size in particular often useful as output metric, particularly for healthcare requirements, deaths etc. (e.g. Table 2 in early COVID modelling) and tables in Roadmap analysis.

pratikunterwegs commented 11 months ago

Thanks - we do have epidemic_size() that calculates size at any point in the simulation, but I'll put in some functions for the peak specifically.

BlackEdder commented 11 months ago

The vignette includes a couple of simple code examples to compare the two approaches. I noticed a couple of differences in the implementation that might be good to think about.

Thanks @BlackEdder, will you keep working on this vignette or should I take this further and make a PR?

Might be most efficient if you would be willing to take this further. Agreed that it would be good to explain in the text, what the main differences are between the two packages. I would hazard that final size is faster, but if you need dynamics over time and/or interventions/vaccinations that happen over time, you should use the epidemics package.

pratikunterwegs commented 11 months ago

Okay thanks, will do.