% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/postprocess-matrix.R
\name{symmetrise}
\alias{symmetrise}
\title{Symmetrise a contact matrix}
\usage{
symmetrise(x, survey_pop, symmetric_norm_threshold = 2, ...)
}
\arguments{
\item{x}{a list as returned by \code{\link[=compute_matrix]{compute_matrix()}}, with elements \code{matrix}
and \code{participants}}

\item{survey_pop}{a data frame with columns \code{lower.age.limit} and
\code{population} (e.g. from \code{\link[=wpp_age]{wpp_age()}})}

\item{symmetric_norm_threshold}{threshold for the normalisation factor
before issuing a warning (default 2)}

\item{...}{passed to \code{\link[=pop_age]{pop_age()}} for interpolation}
}
\value{
\code{x} with \verb{$matrix} replaced by the symmetrised version
}
\description{
Makes a contact matrix symmetric so that \eqn{c_{ij} N_i = c_{ji} N_j},
where \eqn{c_{ij}} is the (i, j) entry and \eqn{N_i} is the population
of age group i. This is done by replacing each pair with half their sum,
weighted by population size.
}
\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)

}
