synthpops.long_term_care_facilities module

Modeling Seattle Metro Long Term Care Facilities

synthpops.long_term_care_facilities.custom_resample_age(exp_age_distr, a)

Resampling younger ages to better match data

Parameters
  • single_year_age_distr (dict) – age distribution

  • age (int) – age as an integer

Returns

Resampled age as an integer.

Notes

This is not always necessary, but is mostly used to smooth out sharp edges in the age distribution when spsamp.resample_age() produces too many of one year and under produces the surrounding ages. For example, new borns (0 years old) may be over produced, and 1 year olds under produced, so this function can be customized to correct for that.

synthpops.long_term_care_facilities.custom_generate_larger_households(size, hh_sizes, hha_by_size_counts, hha_brackets, age_brackets, age_by_brackets_dic, contact_matrix_dic, single_year_age_distr)

Generate ages of those living in households of greater than one individual. Reference individual is sampled conditional on the household size. 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.

Parameters
  • size (int) – The household size.

  • 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.

  • age_brackets (dict) – A dictionary mapping age bracket keys to age bracket range.

  • age_by_brackets_dic (dict) – A dictionary mapping age to the age bracket range it falls within.

  • contact_matrix_dic (dict) – A dictionary of the age-specific contact matrix for different physical contact settings.

  • single_year_age_distr (dict) – The age distribution.

Returns

An array of households for size size 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.

synthpops.long_term_care_facilities.custom_generate_all_households(N, hh_sizes, hha_by_size_counts, hha_brackets, age_brackets, age_by_brackets_dic, contact_matrix_dic, single_year_age_distr)

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.

Parameters
  • N (int) – The number of people in the population.

  • 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.

  • age_brackets (dict) – The dictionary mapping age bracket keys to age bracket range.

  • age_by_brackets_dic (dict) – The dictionary mapping age to the age bracket range it falls within.

  • contact_matrix_dic (dict) – The dictionary of the age-specific contact matrix for different physical contact settings.

  • single_year_age_distr (dict) – The age distribution.

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.

synthpops.long_term_care_facilities.generate_microstructure_with_facilities(datadir, location, state_location, country_location, n, sheet_name='United States of America', use_two_group_reduction=False, average_LTCF_degree=20, ltcf_staff_age_min=20, ltcf_staff_age_max=60, school_enrollment_counts_available=False, with_school_types=False, school_mixing_type='random', average_class_size=20, inter_grade_mixing=0.1, average_student_teacher_ratio=20, average_teacher_teacher_degree=3, teacher_age_min=25, teacher_age_max=75, average_student_all_staff_ratio=15, average_additional_staff_degree=20, staff_age_min=20, staff_age_max=75, verbose=False, plot=False, write=False, return_popdict=False, use_default=False)
synthpops.long_term_care_facilities.check_all_residents_are_connected_to_staff(popdict)