src.create_initial_states.create_initial_immunity
¶
Module Contents¶
Functions¶
|
Create a Series with initial immunity. |
|
Calculate the probability to be immune by county and age group. |
|
Calculate the immunity probability from initial infections. |
|
Conditional probability to be immune, given not endogenously immune. |
- create_initial_immunity(empirical_infections, synthetic_data, initial_infections, date, seed, reporting_delay, population_size)[source]¶
Create a Series with initial immunity.
- Parameters
empirical_infections (pandas.Series) – Newly infected Series with the index levels [“date”, “county”, “age_group_rki”]. These must already be corrected to include undetected cases.
synthetic_data (pandas.DataFrame) – Dataset with one row per simulated individual. Must contain the columns age_group_rki and county.
initial_infections (pandas.DataFrame) – DataFrame with same index as synthetic_data and one column for each day until date. Dtype is boolean. It is assumed that these already include undetected cases.
seed (int) –
reporting_delay (int) – Number of days by which the reporting of cases is delayed. If given, later days are used to get the infections of the demanded time frame.
population_size (int) – Size of the population behind the empirical_infections.
- Returns
Boolean series with same index as synthetic_data.
- Return type
pd.Series
- _calculate_total_immunity_prob(total_immunity, synthetic_data, population_size)[source]¶
Calculate the probability to be immune by county and age group.
- Parameters
total_immunity (pandas.Series) – index are the county and age group. Values are the total numbers of immune individuals. These must already include undetected cases.
synthetic_data (pandas.DataFrame) – DataFrame of synthetic individuals. Must contain age_group_rki and county as columns.
population_size (int) – number of individuals in the population from which the total_immunity was calculated.
- Returns
- Index are county and age group
combinations. Values are the probabilities of individuals of a particular county and age group to be immune.
- Return type
immunity_prob (pandas.Series)
- _calculate_endog_immunity_prob(initial_infections, synthetic_data)[source]¶
Calculate the immunity probability from initial infections.
- Parameters
initial_infections (pandas.DataFrame) – DataFrame with same index as synthetic_data and one column for each day between start and end. Dtype is boolean.
synthetic_data (pandas.DataFrame) – Dataset with one row per simulated individual. Must contain the columns age_group_rki and county.
- Returns
- Probabilities
to become initially infected by age group and county.
- Return type
prob_endog_immune (pandas.Series)