src.estimation.msm_criterion

Module Contents

Functions

get_parallelizable_msm_criterion(prefix, fall_start_date, fall_end_date, spring_start_date, spring_end_date, mode, debug)

Get a parallelizable msm criterion function.

get_index_bundles(params)

Get indices of parameters that are constrained to be equal.

_build_and_evaluate_msm_func(params, seed, prefix, fall_start_date, fall_end_date, spring_start_date, spring_end_date, mode, debug)

_combine_results(results, weights)

_concatenate_pd_objects_from_dicts(dicts)

_build_and_evaluate_msm_func_one_season(params, seed, prefix, start_date, end_date, debug, group_share_known_case_path=None)

Build and evaluate a msm criterion function.

_aggregate_infection_channels(simulate_result)

Aggregate the infection channel data that was calculated in each period.

_get_period_outputs_for_simulate()

Construct the period_outputs argument for get_simulate_func.

_get_calc_moments()

Construct the calc_moments argument for get_msm_func.

_calculate_share_known_cases(sim_out)

_aggregate_period_virus_share(sim_out, strain)

_get_empirical_moments(df, age_group_sizes, state_sizes, start_date, end_date)

Construct the empirical_moments argument for get_msm_func.

_get_weighting_matrix(empirical_moments, age_weights, state_weights)

Get a weighting matrix for msm estimation.

_get_grouped_weight_series(group_weights, moment_series, scaling_factor=1)

Create a weight Series for a moment defined on a group level.

get_parallelizable_msm_criterion(prefix, fall_start_date, fall_end_date, spring_start_date, spring_end_date, mode, debug)[source]

Get a parallelizable msm criterion function.

get_index_bundles(params)[source]

Get indices of parameters that are constrained to be equal.

_build_and_evaluate_msm_func(params, seed, prefix, fall_start_date, fall_end_date, spring_start_date, spring_end_date, mode, debug)[source]
_combine_results(results, weights)[source]
_concatenate_pd_objects_from_dicts(dicts)[source]
_build_and_evaluate_msm_func_one_season(params, seed, prefix, start_date, end_date, debug, group_share_known_case_path=None)[source]

Build and evaluate a msm criterion function.

Building the criterion function freshly for each run is necessary for it to be parallelizable.

_aggregate_infection_channels(simulate_result)[source]

Aggregate the infection channel data that was calculated in each period.

_get_period_outputs_for_simulate()[source]

Construct the period_outputs argument for get_simulate_func.

All estimation moments as well as the infection channel data are calculated as per period outcomes. This needs much less memory than calculating those outcomes from the full time series.

_get_calc_moments()[source]

Construct the calc_moments argument for get_msm_func.

Instead of calculating those moments from the full time series we provide functions that simply aggregate and smooth the per period outcomes that are calculated on each simulated day.

_calculate_share_known_cases(sim_out)[source]
_aggregate_period_virus_share(sim_out, strain)[source]
_get_empirical_moments(df, age_group_sizes, state_sizes, start_date, end_date)[source]

Construct the empirical_moments argument for get_msm_func.

_get_weighting_matrix(empirical_moments, age_weights, state_weights)[source]

Get a weighting matrix for msm estimation.

_get_grouped_weight_series(group_weights, moment_series, scaling_factor=1)[source]

Create a weight Series for a moment defined on a group level.

group_weights (pd.Series or dict): Dict or series with group

labels as index or keys and group weights as values.

moment_series (pd.Series): The empirical moment for which the

weights are constructed. It is assumed that the group is indicated by the second index level.