contactmatrix retrieves various social contact matrices
for Germany from the POLYMOD survey (Mossong et al., 2008). Such a matrix
contains the average numbers of reported contacts by participant age group.
The original age groups (5-year intervals) can be joined together by the
grouping argument, which first sums over contact groups (columns) and
then averages over the corresponding participant groups (rows) using the
corresponding age distribution as weights.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
contactmatrix(which = c("corrected", "mossong", "reciprocal"), type = c("all", "physical"), grouping = c(1, 2, 2, 4, 4, 2), normalize = FALSE) contactmatrix_mossong contactmatrix_mossong_physical contactmatrix_POLYMOD contactmatrix_POLYMOD_physical contactmatrix_wallinga contactmatrix_wallinga_physical
character string indicating which contact matrix to return.
a character string to select the type of contacts to use:
specification of how to aggregate groups (a named list or
an integer vector of group sizes) using
a logical indicating whether to normalize the matrix such that each row sums to 1.
contactmatrix_POLYMOD and its variants are all
square numeric matrices with 15 rows (participants) and 15 columns
(contacts), labelled with the corresponding age groups. There is an attribute
"agedistri", a named numeric vector of length 15, which for the
“_mossong_” and “_POLYMOD_” variants gives the
age distribution of the German POLYMOD sample, and for the
variants gives the age distribution of Berlin, i.e.,
a square numeric matrix containing the average numbers of contact persons recorded per day per survey participant in Germany, potentially averaged over multiple row (participant) age groups and aggregated over the corresponding column (contact) age groups.
are taken from the Supporting Information in Mossong et al. (2008):
the matrices from Table S5 (8.2), and the attached age distribution
from Table S2 (3.2).
The corrected versions
contactmatrix_POLYMOD_physical were constructed from the raw POLYMOD
data available at
The reciprocal contact matrices
contactmatrix_wallinga_physical were estimated from these raw data
via the method of Wallinga et al. (2006).
Meyer S and Held L (2017): Incorporating social contact data in spatio-temporal models for infectious disease spread. Biostatistics, 18 (2), 338-351. doi: 10.1093/biostatistics/kxw051
Mossong et al. (2008): Social contacts and mixing patterns relevant to the spread of infectious diseases. PLoS Medicine, 5 (3), e74. doi: 10.1371/journal.pmed.0050074
Wallinga J, Teunis P and Kretzschmar M (2006): Using data on social contacts to estimate age-specific transmission parameters for respiratory-spread infectious agents. American Journal of Epidemiology, 164 (10), 936-944. doi: 10.1093/aje/kwj317
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
## contact matrix reported in Mossong et al (2008, Table S5) (C_original <- contactmatrix(which = "mossong", grouping = NULL)) ## this simply returns the dataset 'contactmatrix_mossong' stopifnot(identical(C_original, contactmatrix_mossong)) ## with corrected numbers for the 70+ age group (the default) C_corrected <- contactmatrix(which = "corrected", grouping = NULL) ## this simply returns the dataset 'contactmatrix_POLYMOD' stopifnot(identical(C_corrected, contactmatrix_POLYMOD)) ## check for differences C_original == round(C_corrected, 2) ## compare entries of last row and last column round(rbind(original = C_original[15,], corrected = C_corrected[15,]), 2) round(cbind(original = C_original[,15], corrected = C_corrected[,15]), 2) ## contact matrix estimated to be reciprocal on the population level C_reciprocal <- contactmatrix(which = "reciprocal", grouping = NULL) ## this simply returns the dataset 'contactmatrix_wallinga' ## (without its "overdisp" attribute) stopifnot(all.equal(C_reciprocal, contactmatrix_wallinga, check.attributes=FALSE)) ## check reciprocity agedistriBE <- attr(C_reciprocal, "agedistri") stopifnot(identical(agedistriBE, prop.table(colSums(pop2011)))) stopifnot(isSymmetric(C_reciprocal * agedistriBE, check.attributes=FALSE)) ## visually compare raw to reciprocal contact matrix if (require("gridExtra")) grid.arrange(plotC(C_corrected, main = "raw"), plotC(C_reciprocal, main = "reciprocal"), nrow = 1) ## select physical contacts and aggregate into 5 age groups contactmatrix(type = "physical", grouping = c(1, 2, 7, 3, 2)) ## the default 6 age groups, normalized to a transition matrix contactmatrix(normalize = TRUE) ## reciprocity also holds for this grouping (C6 <- contactmatrix(which = "reciprocal")) stopifnot(isSymmetric(C6 * attr(C6, "agedistri"), check.attributes=FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.