generate_all_households_fixed_ages#
- generate_all_households_fixed_ages(n_remaining, hh_sizes, hha_by_size, hha_brackets, cm_age_brackets, cm_age_by_brackets, contact_matrices, ages_left_to_assign)[source]#
Generate the ages of those living in households together. First create households of people living alone, then larger households. For households larger than 1, a reference individual’s age is sampled conditional on the household size, while all other household members have their ages sampled conditional on the reference person’s age and the age mixing contact matrix in households for the population under study. Fix the count of ages in the population before placing individuals in households so that the age distribution of the generated population is fixed to closely match the age distribution from data on the population.
- Parameters:
n_remaining (int) – The number of people in the population left to place in a residence.
hh_sizes (array) – The count of household size s at index s-1.
hha_by_size_counts (matrix) – A matrix in which each row contains the age distribution of the reference person for household size s at index s-1.
hha_brackets (dict) – The age brackets for the heads of household.
cm_age_brackets (dict) – The dictionary mapping age bracket keys to age bracket range matching the household contact matrix.
cm_age_by_brackets (dict) – The dictionary mapping age to the age bracket range it falls within matching the household contact matrix.
contact_matrices (dict) – The dictionary of the age-specific contact matrix for different physical contact settings.
ages_left_to_assign (dict) – Age count of people left to place in households larger than one person.
- Returns:
An array of all households where each household is a row and the values in the row are the ages of the household members. The first age in the row is the age of the reference individual. Households are randomly shuffled by size.