sid.policies

This module contains the code to for applying contact policies.

Module Contents

Functions

apply_contact_policies(contact_policies: Dict[str, Dict[str, Any]], contacts: pandas.DataFrame, states: pandas.DataFrame, date: pandas.Timestamp, seed: itertools.count) → pandas.DataFrame

Apply policies to contacts.

compute_pseudo_effect_sizes_of_policies(policies: Dict[str, Dict[str, Any]], states: Optional[pandas.DataFrame] = None) → Dict[str, Dict[str, Union[float, pandas.Series]]]

Compute pseudo effect sizes of policies.

_find_date_where_policy_is_active(policy)

apply_contact_policies(contact_policies: Dict[str, Dict[str, Any]], contacts: pandas.DataFrame, states: pandas.DataFrame, date: pandas.Timestamp, seed: itertools.count) pandas.DataFrame[source]

Apply policies to contacts.

compute_pseudo_effect_sizes_of_policies(policies: Dict[str, Dict[str, Any]], states: Optional[pandas.DataFrame] = None) Dict[str, Dict[str, Union[float, pandas.Series]]][source]

Compute pseudo effect sizes of policies.

This function returns either the multiplicand of a policy or computes a pseudo effect size by passing a pandas.Series with booleans set to True to the policy function. The effect size is the average of the returned pandas.Series.

How is the effect size interpreted.

  1. The effect is an average treatment effect on the whole population since this simple approach cannot infer which share of the population is affected by the policy.

  2. The pseudo effect size can be interpreted as an effect on the average of contacts for this contact model.

Parameters
  • policies (Dict[str, Dict[str, Any]]) – A policy dictionary.

  • states (pd.DataFrame, optional) – The states.

Returns

effects – A dictionary containing for each contact model the mean effect size and a raw effect size if a pseudo effect was computed.

Return type

Dict[str, Dict[str, Union[float, pd.Series]]]

_find_date_where_policy_is_active(policy)[source]