hhh4contacts (version 0.13.1)

aggregateC: Aggregate a Contact Matrix

Description

The (age) groups of a contact matrix can be joined together by the grouping argument, which first sums over contact groups (columns) and then averages over the corresponding participant groups (rows), optionally using weights such as the age distribution of the study participants.

Usage

aggregateC(C, grouping, ..., weights = NULL)

Arguments

C

a square numeric contact matrix such as contactmatrix_POLYMOD.

grouping

specification of how to aggregate groups (a named list or an integer vector of group sizes) using aggregateC with the "agedistri" attribute of the contact matrix as weights. If NULL, the original 5-year intervals are returned. The default setting produces the six age groups of Meyer and Held (2017).

...

specification of how to aggregate groups (alternative to using a named list as the grouping argument).

weights

a named numeric vector containing the weights for the rows of C, typically the age distribution of the participants. The names are matched against rownames(C). A value of NULL is interpreted as uniform weights.

Author

Sebastian Meyer