% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/contact-matrix-utils.R
\name{normalise_weights}
\alias{normalise_weights}
\title{Post-stratification weight normalisation}
\usage{
normalise_weights(participants, by = "age.group", threshold = NULL)
}
\arguments{
\item{participants}{participant data.table with a \code{weight} column}

\item{by}{character; column name(s) to group by (default "age.group")}

\item{threshold}{numeric; if provided, weights above this value are capped
and the weights are re-normalised (default NULL)}
}
\value{
the participants data.table (modified by reference)
}
\description{
Normalises participant weights within groups so that they sum to the number
of participants in each group. Optionally truncates extreme weights to a
threshold and re-normalises.
}
\keyword{internal}
