aggregateC: Aggregate a Contact Matrix

aggregateCR Documentation

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. grouping can be a named list of vectors of group labels, or an integer vector of sequential group sizes. Alternatively, if grouping is missing, the elements of the list representation can be passed directly as further arguments (...).

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(s)

Sebastian Meyer


hhh4contacts documentation built on Oct. 8, 2024, 1:08 a.m.