finalsize
R package to calculate the final size of an SIR epidemic in populations with heterogeneity in social contacts and disease susceptibility
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.7%) to scientific vocabulary
Keywords
epidemic-modelling
epidemiology
epiverse
outbreak-analysis
r
r-package
rcpp
sdg-3
Last synced: 6 months ago
·
JSON representation
·
Repository
R package to calculate the final size of an SIR epidemic in populations with heterogeneity in social contacts and disease susceptibility
Basic Info
- Host: GitHub
- Owner: epiverse-trace
- License: other
- Language: R
- Default Branch: main
- Homepage: https://epiverse-trace.github.io/finalsize/
- Size: 11.2 MB
Statistics
- Stars: 13
- Watchers: 7
- Forks: 6
- Open Issues: 18
- Releases: 3
Topics
epidemic-modelling
epidemiology
epiverse
outbreak-analysis
r
r-package
rcpp
sdg-3
Created almost 4 years ago
· Last pushed 9 months ago
Metadata Files
Readme
Changelog
Contributing
License
Citation
README.Rmd
---
output: github_document
bibliography: vignettes/references.json
link-citations: true
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# {{ packagename }}: Calculate the final size of an epidemic
[](https://opensource.org/license/mit)
[](https://www.repostatus.org/#active)
[](https://github.com/{{ gh_repo }}/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/{{ gh_repo }}?branch=main)
[](https://CRAN.R-project.org/package=finalsize)
_{{ packagename }}_ is an R package to calculate the final size of a SIR epidemic in populations with heterogeneity in social contacts and infection susceptibility.
_{{ packagename }}_ provides estimates for the total proportion of a population infected over the course of an epidemic, and can account for a demographic distribution (such as age groups) and demography-specific contact patterns, as well as for heterogeneous susceptibility to infection between groups (such as due to age-group specific immune responses) and within groups (such as due to immunisation programs). An advantage of this approach is that it requires fewer parameters to be defined compared to a model that simulates the full transmission dynamics over time, such as models in the [_epidemics_ package](https://epiverse-trace.github.io/epidemics/articles/epidemics.html).
_{{ packagename }}_ implements methods outlined in @andreasen2011, @miller2012, @kucharski2014, and @bidari2016.
_{{ packagename }}_ can help provide rough estimates of the effectiveness of pharmaceutical interventions in the form of immunisation programmes, or the effect of naturally acquired immunity through previous infection (see the vignette).
_{{ packagename }}_ relies on [Eigen](https://gitlab.com/libeigen/eigen) via [RcppEigen](https://github.com/RcppCore/RcppEigen) for fast matrix algebra, and is developed at the [Centre for the Mathematical Modelling of Infectious Diseases](https://www.lshtm.ac.uk/research/centres/centre-mathematical-modelling-infectious-diseases) at the London School of Hygiene and Tropical Medicine as part of the [Epiverse-TRACE](https://data.org/initiatives/epiverse/).
## Installation
The package can be installed from CRAN using
```r
install.packages("finalsize")
```
### Development version
The current development version of _{{ packagename }}_ can be installed from [Github](https://github.com/{{ gh_repo }}) using the `remotes` package.
The development version documentation can be found [here](https://epiverse-trace.github.io/finalsize/dev/).
```r
if(!require("pak")) install.packages("pak")
pak::pak("{{ gh_repo }}")
```
## Quick start
The main function in _{{ packagename }}_ is `final_size()`, which calculates the final size of an epidemic given the $R_0$.
```{r}
# load finalsize
library(finalsize)
final_size(1.5)
```
Optionally, `final_size()` can estimate the epidemic size for populations with differences among demographic groups in their social contact patterns, in their susceptibility to infection.
We can use social contact data (here, from the _socialmixr_ package) to estimate the final size of an epidemic when the disease has an R0 of 1.5, and given three age groups of interest --- 0-19, 20-39 and 40+.
The under-20 age group is assumed to be fully susceptible to the disease, whereas individuals aged over 20 are only half as susceptible as those under 20.
```{r}
# Load example POLYMOD social contacts data included with the package
data(polymod_uk)
# Define contact matrix (entry {ij} is contacts in group i reported by group j)
contact_matrix <- polymod_uk$contact_matrix
# Define population in each age group
demography_vector <- polymod_uk$demography_vector
# Define susceptibility of each group
susceptibility <- matrix(
data = c(1.0, 0.5, 0.5),
nrow = length(demography_vector),
ncol = 1
)
# Assume uniform susceptibility within age groups
p_susceptibility <- matrix(
data = 1.0,
nrow = length(demography_vector),
ncol = 1
)
# R0 of the disease
r0 <- 1.5 # assumed for pandemic influenza
# Calculate the proportion of individuals infected in each age group
final_size(
r0 = r0,
contact_matrix = contact_matrix,
demography_vector = demography_vector,
susceptibility = susceptibility,
p_susceptibility = p_susceptibility
)
```
Helper functions included in _{{ packagename }}_ are provided to calculate the effective $R_0$, called $R_{eff}$, from demographic and susceptibility distribution data, while other helpers can convert between $R_0$ and the transmission rate $\lambda$.
```{r}
# calculate the effective R0 using `r_eff()`
r_eff(
r0 = r0,
contact_matrix = contact_matrix,
demography_vector = demography_vector,
susceptibility = susceptibility,
p_susceptibility = p_susceptibility
)
```
## Package vignettes
More details on how to use _{{ packagename }}_ can be found in the [online documentation as package vignettes](https://epiverse-trace.github.io/finalsize/), under "Articles".
## Help
To report a bug please open an [issue](https://github.com/{{ gh_repo }}/issues/new/choose).
## Contribute
Contributions to _{{ packagename }}_ are welcomed. Please follow the [package contributing guide](https://github.com/{{ gh_repo }}/blob/main/.github/CONTRIBUTING.md).
## Code of conduct
Please note that the _{{ packagename }}_ project is released with a [Contributor Code of Conduct](https://github.com/epiverse-trace/.github/blob/main/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.
## Citing this package
```{r message=FALSE, warning=FALSE}
citation("finalsize")
```
## References
Owner
- Name: Epiverse-TRACE
- Login: epiverse-trace
- Kind: organization
- Website: https://epiverse.org
- Repositories: 17
- Profile: https://github.com/epiverse-trace
Citation (CITATION.cff)
# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
cff-version: 1.2.0
message: 'To cite package "finalsize" in publications use:'
type: software
license: MIT
title: 'finalsize: Calculate the Final Size of an Epidemic'
version: 0.2.1.9000
abstract: Calculate the final size of a susceptible-infectious-recovered epidemic
in a population with demographic variation in contact patterns and susceptibility
to disease, as discussed in Miller (2012) <https://doi.org/10.1007/s11538-012-9749-6>.
authors:
- family-names: Gupte
given-names: Pratik
email: pratik.gupte@lshtm.ac.uk
orcid: https://orcid.org/0000-0001-5294-7819
- family-names: Van Leeuwen
given-names: Edwin
email: edwin.vanleeuwen@ukhsa.gov.uk
orcid: https://orcid.org/0000-0002-2383-5305
- family-names: Kucharski
given-names: Adam
email: adam.kucharski@lshtm.ac.uk
orcid: https://orcid.org/0000-0001-8814-9421
- family-names: Eggo
given-names: Rosalind
email: r.eggo@lshtm.ac.uk
orcid: https://orcid.org/0000-0002-0362-6717
repository: https://CRAN.R-project.org/package=finalsize
repository-code: https://github.com/epiverse-trace/finalsize
url: https://epiverse-trace.github.io/finalsize/
contact:
- family-names: Eggo
given-names: Rosalind
email: r.eggo@lshtm.ac.uk
orcid: https://orcid.org/0000-0002-0362-6717
keywords:
- epidemic-modelling
- epidemiology
- epiverse
- outbreak-analysis
- r
- r-package
- rcpp
- sdg-3
references:
- type: software
title: 'R: A Language and Environment for Statistical Computing'
notes: Depends
url: https://www.R-project.org/
authors:
- name: R Core Team
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
version: '>= 2.10'
- type: software
title: checkmate
abstract: 'checkmate: Fast and Versatile Argument Checks'
notes: Imports
url: https://mllg.github.io/checkmate/
repository: https://CRAN.R-project.org/package=checkmate
authors:
- family-names: Lang
given-names: Michel
email: michellang@gmail.com
orcid: https://orcid.org/0000-0001-9754-0393
year: '2024'
- type: software
title: Rcpp
abstract: 'Rcpp: Seamless R and C++ Integration'
notes: Imports
url: https://www.rcpp.org
repository: https://CRAN.R-project.org/package=Rcpp
authors:
- family-names: Eddelbuettel
given-names: Dirk
- family-names: Francois
given-names: Romain
- family-names: Allaire
given-names: JJ
- family-names: Ushey
given-names: Kevin
- family-names: Kou
given-names: Qiang
- family-names: Russell
given-names: Nathan
- family-names: Ucar
given-names: Inaki
- family-names: Bates
given-names: Douglas
- family-names: Chambers
given-names: John
year: '2024'
- type: software
title: bookdown
abstract: 'bookdown: Authoring Books and Technical Documents with R Markdown'
notes: Suggests
url: https://pkgs.rstudio.com/bookdown/
repository: https://CRAN.R-project.org/package=bookdown
authors:
- family-names: Xie
given-names: Yihui
email: xie@yihui.name
orcid: https://orcid.org/0000-0003-0645-5666
year: '2024'
- type: software
title: colorspace
abstract: 'colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes'
notes: Suggests
url: https://colorspace.R-Forge.R-project.org/contact.html
repository: https://CRAN.R-project.org/package=colorspace
authors:
- family-names: Ihaka
given-names: Ross
email: ihaka@stat.auckland.ac.nz
- family-names: Murrell
given-names: Paul
email: paul@stat.auckland.ac.nz
orcid: https://orcid.org/0000-0002-3224-8858
- family-names: Hornik
given-names: Kurt
email: Kurt.Hornik@R-project.org
orcid: https://orcid.org/0000-0003-4198-9911
- family-names: Fisher
given-names: Jason C.
email: jfisher@usgs.gov
orcid: https://orcid.org/0000-0001-9032-8912
- family-names: Stauffer
given-names: Reto
email: Reto.Stauffer@uibk.ac.at
orcid: https://orcid.org/0000-0002-3798-5507
- family-names: Wilke
given-names: Claus O.
email: wilke@austin.utexas.edu
orcid: https://orcid.org/0000-0002-7470-9261
- family-names: McWhite
given-names: Claire D.
email: claire.mcwhite@utmail.utexas.edu
orcid: https://orcid.org/0000-0001-7346-3047
- family-names: Zeileis
given-names: Achim
email: Achim.Zeileis@R-project.org
orcid: https://orcid.org/0000-0003-0918-3766
year: '2024'
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
notes: Suggests
url: https://dplyr.tidyverse.org
repository: https://CRAN.R-project.org/package=dplyr
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: François
given-names: Romain
orcid: https://orcid.org/0000-0002-2444-4226
- family-names: Henry
given-names: Lionel
- family-names: Müller
given-names: Kirill
orcid: https://orcid.org/0000-0002-1416-3412
- family-names: Vaughan
given-names: Davis
email: davis@posit.co
orcid: https://orcid.org/0000-0003-4777-038X
year: '2024'
- type: software
title: forcats
abstract: 'forcats: Tools for Working with Categorical Variables (Factors)'
notes: Suggests
url: https://forcats.tidyverse.org/
repository: https://CRAN.R-project.org/package=forcats
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
year: '2024'
- type: software
title: ggplot2
abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
notes: Suggests
url: https://ggplot2.tidyverse.org
repository: https://CRAN.R-project.org/package=ggplot2
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: Chang
given-names: Winston
orcid: https://orcid.org/0000-0002-1576-2126
- family-names: Henry
given-names: Lionel
- family-names: Pedersen
given-names: Thomas Lin
email: thomas.pedersen@posit.co
orcid: https://orcid.org/0000-0002-5147-4711
- family-names: Takahashi
given-names: Kohske
- family-names: Wilke
given-names: Claus
orcid: https://orcid.org/0000-0002-7470-9261
- family-names: Woo
given-names: Kara
orcid: https://orcid.org/0000-0002-5125-4188
- family-names: Yutani
given-names: Hiroaki
orcid: https://orcid.org/0000-0002-3385-7233
- family-names: Dunnington
given-names: Dewey
orcid: https://orcid.org/0000-0002-9415-4582
- family-names: Brand
given-names: Teun
name-particle: van den
orcid: https://orcid.org/0000-0002-9335-7468
year: '2024'
- type: software
title: ggtext
abstract: 'ggtext: Improved Text Rendering Support for ''ggplot2'''
notes: Suggests
url: https://wilkelab.org/ggtext/
repository: https://CRAN.R-project.org/package=ggtext
authors:
- family-names: Wilke
given-names: Claus O.
email: wilke@austin.utexas.edu
orcid: https://orcid.org/0000-0002-7470-9261
- family-names: Wiernik
given-names: Brenton M.
email: brenton@wiernik.org
orcid: https://orcid.org/0000-0001-9560-6336
year: '2024'
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
notes: Suggests
url: https://yihui.org/knitr/
repository: https://CRAN.R-project.org/package=knitr
authors:
- family-names: Xie
given-names: Yihui
email: xie@yihui.name
orcid: https://orcid.org/0000-0003-0645-5666
year: '2024'
- type: software
title: purrr
abstract: 'purrr: Functional Programming Tools'
notes: Suggests
url: https://purrr.tidyverse.org/
repository: https://CRAN.R-project.org/package=purrr
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: Henry
given-names: Lionel
email: lionel@rstudio.com
year: '2024'
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
notes: Suggests
url: https://pkgs.rstudio.com/rmarkdown/
repository: https://CRAN.R-project.org/package=rmarkdown
authors:
- family-names: Allaire
given-names: JJ
email: jj@posit.co
- family-names: Xie
given-names: Yihui
email: xie@yihui.name
orcid: https://orcid.org/0000-0003-0645-5666
- family-names: Dervieux
given-names: Christophe
email: cderv@posit.co
orcid: https://orcid.org/0000-0003-4474-2498
- family-names: McPherson
given-names: Jonathan
email: jonathan@posit.co
- family-names: Luraschi
given-names: Javier
- family-names: Ushey
given-names: Kevin
email: kevin@posit.co
- family-names: Atkins
given-names: Aron
email: aron@posit.co
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Cheng
given-names: Joe
email: joe@posit.co
- family-names: Chang
given-names: Winston
email: winston@posit.co
- family-names: Iannone
given-names: Richard
email: rich@posit.co
orcid: https://orcid.org/0000-0003-3925-190X
year: '2024'
- type: software
title: scales
abstract: 'scales: Scale Functions for Visualization'
notes: Suggests
url: https://scales.r-lib.org
repository: https://CRAN.R-project.org/package=scales
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Pedersen
given-names: Thomas Lin
email: thomas.pedersen@posit.co
orcid: https://orcid.org/0000-0002-5147-4711
- family-names: Seidel
given-names: Dana
year: '2024'
- type: software
title: socialmixr
abstract: 'socialmixr: Social Mixing Matrices for Infectious Disease Modelling'
notes: Suggests
url: https://epiforecasts.io/socialmixr/
repository: https://CRAN.R-project.org/package=socialmixr
authors:
- family-names: Funk
given-names: Sebastian
email: sebastian.funk@lshtm.ac.uk
- family-names: Willem
given-names: Lander
- family-names: Gruson
given-names: Hugo
year: '2024'
- type: software
title: spelling
abstract: 'spelling: Tools for Spell Checking in R'
notes: Suggests
url: https://ropensci.r-universe.dev/spelling
repository: https://CRAN.R-project.org/package=spelling
authors:
- family-names: Ooms
given-names: Jeroen
email: jeroen@berkeley.edu
orcid: https://orcid.org/0000-0002-4035-0289
- family-names: Hester
given-names: Jim
email: james.hester@rstudio.com
year: '2024'
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
notes: Suggests
url: https://testthat.r-lib.org
repository: https://CRAN.R-project.org/package=testthat
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
year: '2024'
version: '>= 3.0.0'
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
notes: Suggests
url: https://tibble.tidyverse.org/
repository: https://CRAN.R-project.org/package=tibble
authors:
- family-names: Müller
given-names: Kirill
email: kirill@cynkra.com
orcid: https://orcid.org/0000-0002-1416-3412
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
year: '2024'
- type: software
title: tidyr
abstract: 'tidyr: Tidy Messy Data'
notes: Suggests
url: https://tidyr.tidyverse.org
repository: https://CRAN.R-project.org/package=tidyr
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Vaughan
given-names: Davis
email: davis@posit.co
- family-names: Girlich
given-names: Maximilian
year: '2024'
- type: software
title: xml2
abstract: 'xml2: Parse XML'
notes: Suggests
url: https://xml2.r-lib.org/
repository: https://CRAN.R-project.org/package=xml2
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Hester
given-names: Jim
- family-names: Ooms
given-names: Jeroen
year: '2024'
- type: software
title: RcppEigen
abstract: 'RcppEigen: ''Rcpp'' Integration for the ''Eigen'' Templated Linear Algebra
Library'
notes: LinkingTo
url: https://dirk.eddelbuettel.com/code/rcpp.eigen.html
repository: https://CRAN.R-project.org/package=RcppEigen
authors:
- family-names: Bates
given-names: Douglas
- family-names: Eddelbuettel
given-names: Dirk
- family-names: Francois
given-names: Romain
- family-names: Eigen
given-names: Yixuan Qiu; the authors of Eigen for the included version of
year: '2024'
GitHub Events
Total
- Issues event: 6
- Watch event: 2
- Issue comment event: 9
- Push event: 5
- Pull request review event: 1
- Pull request event: 5
- Create event: 2
Last Year
- Issues event: 6
- Watch event: 2
- Issue comment event: 9
- Push event: 5
- Pull request review event: 1
- Pull request event: 5
- Create event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 83
- Total pull requests: 90
- Average time to close issues: about 1 month
- Average time to close pull requests: 6 days
- Total issue authors: 7
- Total pull request authors: 8
- Average comments per issue: 1.19
- Average comments per pull request: 1.09
- Merged pull requests: 80
- Bot issues: 0
- Bot pull requests: 4
Past Year
- Issues: 7
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: 26 days
- Issue authors: 3
- Pull request authors: 2
- Average comments per issue: 0.43
- Average comments per pull request: 2.67
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 2
Top Authors
Issue Authors
- pratikunterwegs (44)
- avallecam (24)
- adamkucharski (6)
- Bisaloo (3)
- BlackEdder (3)
- TimTaylor (2)
- erees (1)
Pull Request Authors
- pratikunterwegs (66)
- Bisaloo (10)
- adamkucharski (5)
- github-actions[bot] (4)
- chartgerink (2)
- rozeggo (1)
- avallecam (1)
- joshwlambert (1)
Top Labels
Issue Labels
Documentation (37)
Cleanup (19)
Discussion (10)
New feature (7)
Quality control (4)
Help wanted (4)
question (3)
Bug (2)
wontfix (2)
good first issue (1)
Pull Request Labels
Documentation (9)
Cleanup (5)
New feature (2)
Full review (1)
Quality control (1)
Help wanted (1)
Packages
- Total packages: 1
-
Total downloads:
- cran 291 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: finalsize
Calculate the Final Size of an Epidemic
- Homepage: https://github.com/epiverse-trace/finalsize
- Documentation: http://cran.r-project.org/web/packages/finalsize/finalsize.pdf
- License: MIT + file LICENSE
-
Latest release: 0.2.1
published almost 2 years ago
Rankings
Forks count: 12.8%
Stargazers count: 22.5%
Dependent packages count: 29.8%
Average: 31.5%
Dependent repos count: 35.5%
Downloads: 57.0%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- Rcpp * imports
- RcppEigen * imports
- checkmate * imports
- covr * suggests
- socialmixr * suggests
- testthat >= 3.0.0 suggests
- xml2 * suggests
.github/workflows/Cpp-lint-check.yaml
actions
- actions/checkout v3 composite
- actions/setup-python v2 composite
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/render_readme.yml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/update-citation-cff.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/dependency-change.yaml
actions
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lint-changed-files.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite