src.create_initial_states.create_contact_model_group_ids
¶
Module Contents¶
Functions¶
|
Create and add contact model group ids to the states. |
|
|
|
|
|
Put groups of households together into groups. |
|
|
|
|
- add_contact_model_group_ids(df, work_daily_dist, work_weekly_dist, other_daily_dist, other_weekly_dist, seed)[source]¶
Create and add contact model group ids to the states.
For children between 6 and 18 we assume everyone who is not working goes to a school class with 23 individuals of the same age. Classes meet their peers and 3 pairs of two teachers per school day.
For children between 3 and 6 we assume that everyone (officially 93%) attends pre-school with a group size of 9 and mixed ages. Mean group sizes vary between 7 and 13 between German states. Every preschool group meets its peers and the same two adults every school day.
For children below 3 we assume that 35% attend a nursery with a group size of 4 and mixed ages. This hides substantial heterogeneity in attendance with respect to age (older children are much more likely to be in day care) and with respect to state (East German children are much more likely to attend nurseries). Mean group sizes vary between 3 and 6 between German states. Every group meets their peers and one adult every school day.
Sources:
percent of children in day care: https://tinyurl.com/yefhpney
percent of children below age 3 in day care: https://tinyurl.com/y6zft8sx
group sizes in early education: https://tinyurl.com/y6tjju6r
- group sizes for school classes: source: https://tinyurl.com/y3xrgxaw
(21.2 for primaries, 24.5 for secondary)
- Parameters
df (pandas.DataFrame) – the states DataFrame
work_daily_dist (pandas.Series) – share of workers reporting a certain number of daily repeating contacts. Index is the number of contacts, the values are the shares.
work_weekly_dist (pandas.Series) – same as work_daily_dist but with weekly repeating contacts.
other_daily_dist (pandas.Series) – share of individuals reportang a certain number of daily repeating contacts. Index is the number of contacts. The values are the shares.
other_weekly_dist (pandas.Series) – same as other_daily_dist but with weekly repeating contacts.
seed (int) –
- Returns
- states with an updated occupation column and
- expanded by the contact model group ids and helper columns:
school_group_id_0
school_group_id_1
school_group_id_2
preschool_group_id_0
nursery_group_id_0
updated occupation column
educ_worker
work_contact_priority
stays_home_when_schools_close
- Return type
df (pandas.DataFrame)
- _sample_household_groups(df, seed, assort_by, same_group_probability=None, n_hhs=3)[source]¶
Put groups of households together into groups.
- Parameters
df (pandas.DataFrame) – states DataFrame
seed (int) –
assort_by (str, optional) – variable on which to assort by
assortativeness (float, optional) – values of assortativeness
n_hhs (int) – Number of households to group together.
- Returns
- Series with the same index as df.
Individuals of households that were grouped together have the same value. The dtype is categorical.
- Return type
id_col (pandas.Series)