Makes a contact matrix symmetric so that \(c_{ij} N_i = c_{ji} N_j\), where \(c_{ij}\) is the (i, j) entry and \(N_i\) is the population of age group i. This is done by replacing each pair with half their sum, weighted by population size.
Arguments
- x
a list as returned by
compute_matrix(), with elementsmatrixandparticipants- survey_pop
a data frame with columns
lower.age.limitandpopulation(e.g. fromwpp_age())- symmetric_norm_threshold
threshold for the normalisation factor before issuing a warning (default 2)
- ...
passed to
pop_age()for interpolation
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() |>
symmetrise(survey_pop = pop)
#> $matrix
#> contact.age.group
#> age.group [0,5) [5,15) 15+
#> [0,5) 1.9157895 1.281846 5.558271
#> [5,15) 0.5994315 7.946078 7.428739
#> 15+ 0.3882175 1.109550 9.594101
#>
#> $participants
#> age.group participants proportion
#> <char> <int> <num>
#> 1: [0,5) 95 0.09396637
#> 2: [5,15) 204 0.20178042
#> 3: 15+ 712 0.70425321
#>