src.estimation.msm_criterion
¶
Module Contents¶
Functions¶
|
Get a parallelizable msm criterion function. |
|
Get indices of parameters that are constrained to be equal. |
|
|
|
|
|
Build and evaluate a msm criterion function. |
|
Aggregate the infection channel data that was calculated in each period. |
Construct the period_outputs argument for |
|
Construct the |
|
|
|
|
|
|
Construct the |
|
Get a weighting matrix for msm estimation. |
|
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.
- _build_and_evaluate_msm_func(params, seed, prefix, fall_start_date, fall_end_date, spring_start_date, spring_end_date, mode, debug)[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 forget_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.
- _get_empirical_moments(df, age_group_sizes, state_sizes, start_date, end_date)[source]¶
Construct the
empirical_moments
argument forget_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.