per_capita: Convert a contact matrix to per-capita rates

View source: R/postprocess-matrix.R

per_capitaR Documentation

Convert a contact matrix to per-capita rates

Description

Divides each column of the contact matrix by the population of the corresponding age group, giving the contact rate of age group i with one individual of age group j.

Usage

per_capita(x, survey_pop, ...)

Arguments

x

a list as returned by compute_matrix(), with elements matrix and participants

survey_pop

a data frame with columns lower.age.limit and population (e.g. from wpp_age())

...

passed to pop_age() for interpolation

Value

x with ⁠$matrix⁠ replaced by the per-capita version

Examples

data(polymod)
pop <- wpp_age("United Kingdom", 2005)
polymod |>
  (\(s) s[country == "United Kingdom"])() |>
  assign_age_groups(age_limits = c(0, 5, 15)) |>
  compute_matrix() |>
  per_capita(survey_pop = pop)


socialmixr documentation built on April 29, 2026, 9:07 a.m.