Social Mixing Matrices for Infectious Disease Modelling

Methods for sampling contact matrices from diary data for use in infectious disease modelling, as discussed in Mossong et al. (2008) .


Social mixing matrices for infectious disease modelling in R

CRANversion R-CMD-check Codecov testcoverage

socialmixr is an R package to derive social mixing matrices from survey data.

Installation

The package can be installed using

install.packages("socialmixr")

The current development version can be installed using the remotes package

remotes::install_github("epiforecasts/socialmixr")

Usage

Contact matrices are computed through a small pipeline of composable functions: subsetting the survey, assigning age groups, optionally weighing participants, and computing the matrix. A minimal example using the included POLYMOD data:

library(socialmixr)
data(polymod)

polymod[country == "United Kingdom"] |>
  assign_age_groups(age_limits = c(0, 1, 5, 15)) |>
  compute_matrix()

Post-processing functions symmetrise(), split_matrix() and per_capita() can be piped after compute_matrix() to enforce symmetry, decompose the matrix, or convert to per-capita contact rates.

Documentation

For more on how to use the socialmixr package, see the introduction vignette.

Contributors

All contributions to this project are gratefully acknowledged using the allcontributors package following the allcontributors specification. Contributions of any kind are welcome!

Code

sbfnk, Bisaloo, lwillem, njtierney, alxsrobert, Degoot-AM, pearsonca, jarvisc1, jamesmbaazam, LloydChapman, mariabnd, ukhsa-tt

Issue Authors

bastistician, BlackEdder, Pinzo1, florpi, cchauve, thutran, dlaydon, deusthindwa, krivit, linyang17, cliu822, TimTaylor, NaomiWaterlow, aakhmetz, adamkucharski, chitrams, IsaacStopard, avallecam, maishaoshao, FrancescoBonacina, lucy-gf

Issue Contributors

vikkytom, joshwlambert, bahadzie, coderabbitai

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("socialmixr")

0.7.0 by Sebastian Funk, 2 months ago


https://github.com/epiforecasts/socialmixr, https://epiforecasts.io/socialmixr/


Report a bug at https://github.com/epiforecasts/socialmixr/issues


Browse source code at https://github.com/cran/socialmixr


Authors: Sebastian Funk [aut, cre] , Lander Willem [aut] , Hugo Gruson [aut] , Nicholas Tierney [aut] , Maria Bekker-Nielsen Dunbar [ctb] , Carl A. B. Pearson [ctb] , Sam Clifford [ctb] , Christopher Jarvis [ctb] , Alexis Robert [ctb] , Niel Hens [ctb] , Pietro Coletti [col, dtm] , Lloyd Chapman [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports checkmate, countrycode, curl, data.table, grDevices, httr, jsonlite, lifecycle, lubridate, memoise, purrr, oai, wpp2017, xml2, cli, rlang, methods

Suggests contactsurveys, ggplot2, here, knitr, quarto, reshape2, rmarkdown, roxyglobals, testthat, withr


Imported by multigroup.vaccine.

Suggested by contactsurveys, finalsize, o2geosocial.


See at CRAN