Learn R Programming

socialmixr (version 0.7.0)

new_contact_matrix: Create a contact_matrix object

Description

Create a contact_matrix object

Usage

new_contact_matrix(
  matrix,
  participants,
  groupings = default_age_groupings(),
  ...
)

Value

a contact_matrix object (an S3 class inheriting from list)

Arguments

matrix

a numeric array. For single-grouping matrices this is a 2D matrix whose dimnames are the grouping's levels (e.g. age groups); for multi-grouping it is a rank-2K array where the first K dimensions index participants and the last K index contacts.

participants

a data.frame with one row per participant grouping combination (participants, proportion, plus one column per grouping)

groupings

the list of grouping triples (see resolve_groupings()) that produced matrix. Defaults to the age-only single-grouping spec used by contact_matrix().

...

additional named elements (e.g. mean.contacts, normalisation, contacts from split_matrix())