aggregate 2.0.0__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aggregate-2.0.0/src/aggregate.egg-info → aggregate-2.1.0}/PKG-INFO +2 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/pyproject.toml +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/__init__.py +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_aggregate.py +12 -6
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_loss_table.py +3 -3
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_pnl.py +4 -4
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_portfolio.py +14 -8
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_pricing.py +26 -10
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_reinsurance.py +67 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_severity.py +285 -39
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/agg/decl-testers.agg +19 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/agg/library.agg +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/characteristic_function.py +6 -6
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_bounds.py +3 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_core.py +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_pricing.py +6 -6
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/formats/formats-insurer.yaml +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/formats/formats-raw.yaml +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/parser.py +81 -14
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/results.py +2 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/spectral.py +508 -40
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/utilities.py +48 -6
- {aggregate-2.0.0 → aggregate-2.1.0/src/aggregate.egg-info}/PKG-INFO +2 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate.egg-info/SOURCES.txt +4 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate.egg-info/requires.txt +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_bivariate.py +10 -2
- aggregate-2.1.0/tests/test_calibrate_extended.py +59 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_bounds.py +18 -3
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_decl_labels.py +108 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_decl_words.py +1 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_distortion_calibrate.py +7 -6
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_distortion_construction.py +47 -29
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_distortion_decl.py +2 -0
- aggregate-2.1.0/tests/test_distortion_from_gini.py +135 -0
- aggregate-2.1.0/tests/test_distortion_tsallis.py +231 -0
- aggregate-2.1.0/tests/test_elt_severity_functions.py +378 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_exhibits.py +5 -5
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_hygiene4.py +3 -3
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_oep.py +426 -338
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl.py +12 -12
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_peel.py +2 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_portfolio_peg_regression.py +9 -9
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pricing_results.py +1 -1
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reins_view_pricing.py +2 -2
- {aggregate-2.0.0 → aggregate-2.1.0}/LICENSE +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/MANIFEST.in +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/README.md +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/setup.cfg +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_aggregate_compute.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_aggregate_compute_massive.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_bucket_window.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_fits.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_frequency.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_grid_distribution.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_help.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_labeled.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_pnl_builders.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_portfolio_common.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_portfolio_density.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_portfolio_sample.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_program.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_renewal.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/_validation.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/agg/recitations.agg +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/agg/reproductions.agg +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/bivariate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/bounds.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/cantor.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/__init__.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_aggregate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_approximation.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_bivariate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_characteristic_function.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_distortion.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_ntt.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_pnl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_portfolio.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_reins.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_ruin.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_severity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_emit_structure.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_payload.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/_two_panel.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/charts/ir.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/config.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/constants.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/contract_terms.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/copula.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/data/aggregate.mplstyle +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/data/config.default.toml +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/data/decl-help/anatomy.html +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/data/decl-help/card.html +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/decl.lark +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/decl_help.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/decl_pygments.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/decl_words/__init__.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/decl_words/__main__.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/decl_writer.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/distributions.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/__init__.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_aggregate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_bivariate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_characteristic_function.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_distortion.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_formats.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_pnl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/exhibits/_portfolio.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/ft.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/iman_conover.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/magics.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/moments.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/ntt.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/parser_errors.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/pedagogy.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/pentagon.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/__init__.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_bivariate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_bivariate_explore.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_bivariate_massive.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_bounds.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_chartdoc.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_distortion.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_fourier.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_portfolio.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plots/_style.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/plugins.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/portfolio.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/random_agg.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/recipe.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/stable.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/style.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/tail.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/tweedie.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate/underwriter.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate.egg-info/dependency_links.txt +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate.egg-info/entry_points.txt +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/src/aggregate.egg-info/top_level.txt +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_agg_as_severity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_agg_ignored_clauses.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_agg_libraries.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_aggregate_compute.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_allocation_bounds.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_allocation_gold_standard.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_approximate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_balanced_window.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_baseline.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_baseline_spotchecks.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_bivariate_density_clip.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_bivariate_exeqa.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_bounds.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_bucket_sizing.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_bv_discrete.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_cantor.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_cantor_severity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_cdf_outside_grid.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_characteristic_function.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_agg.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_approximation.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_distortion.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_exact_tail.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_kappa.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_marks.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_pnl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_port.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_reins.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_severity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_structure.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chart_surface_pilot.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chartdoc_ladder.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chartdoc_matrix.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chartdoc_readings.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_chartdoc_render.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_charts_ir.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_composition_matrix.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_config.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_convex_distortion.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_create_frequency.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_create_pnl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_decl_help.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_decl_parser.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_decl_unparser.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_derived_programs.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_disappearing_deductible.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_discrete_severity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_distortion_quartet.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_distortion_snapshot.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_dsev_bucket.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_elt.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_elt_uncertainty.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_evaluate_anchor.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_exhibit_formats.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_fcc_surface.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_feasibility.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_fit_page.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_franchise_deductible.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_freq_df.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_frequency_zm.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_ft.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_fyi_premium.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_grammar_ambiguity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_grammar_sync.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_grid_distribution.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_help.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_hints.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_hygiene3.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_input_guards_fixed_count.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_joint_row_bands.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_lattice_bucket.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_lattice_oracle.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_layer_pdf_point_mass.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_layer_tail_moments.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_library_entries.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_loss_table_files.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_loss_table_reports.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_magics.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_massive_bivariate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_mixture_thinning.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_moment_deficit.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_moments.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_natural_allocation.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_negative_x.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_negative_x_port.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_netceded_sizing.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_ntt.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_numerics2_objective.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_numerics3_distortion.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_occurrence_annual_terms.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_palm.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_paren_arithmetic.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_parser_errors.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_parser_errors_integration.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_partial_e_beta_lomax.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_partial_e_pareto.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pedagogy_repairs.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pedagogy_tilt.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pgf_polynomial.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_picks.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_plot_return_period.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_plots_boundary.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_plugins.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_ceded_premium.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_consolidated_walk.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_derive_premium.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_engine_source.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_expenses.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_kappa_level_sets.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pnl_pentagon.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_portfolio_subsystems.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_price_pentagon.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_pricing_bounds.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_priority.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_prob_loss_assets.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_quoted_literals.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_recipe.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reference_severity.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reference_trailer.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reins_bivariate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reins_buckets.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reins_reporting.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reinstatement_decl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reinstatement_pushforward.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_reinstatement_terms.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_renewal.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_renewal_agg.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_renewal_decl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_round_bucket.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_ruin.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_session_isolation.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_severity_layer_golden.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_severity_parameter_count.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_sharpen.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_shifted_severity_moments.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_signed_calibrate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_splice_suite.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_stable.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_style.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_tail.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_trailer_attachment.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_tweedie.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_unbounded_anchor.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_underwriter.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_unit_capital_above_frame.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_unit_density.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_unparse_dense_spec_guard.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_validation.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_variable_rating_decl.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_variable_rating_terms.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_warning_policy.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_windowed_calibrate.py +0 -0
- {aggregate-2.0.0 → aggregate-2.1.0}/tests/test_yelt.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aggregate
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Tools for creating and working with aggregate probability distributions.
|
|
5
5
|
Author-email: "Stephen J. Mildenhall" <mynl@me.com>
|
|
6
6
|
Maintainer-email: "Stephen J. Mildenhall" <mynl@me.com>
|
|
@@ -61,7 +61,7 @@ Requires-Dist: datashader; extra == "viz"
|
|
|
61
61
|
Requires-Dist: holoviews; extra == "viz"
|
|
62
62
|
Requires-Dist: bokeh; extra == "viz"
|
|
63
63
|
Provides-Extra: elt
|
|
64
|
-
Requires-Dist: eltq>=2.
|
|
64
|
+
Requires-Dist: eltq>=2.15; extra == "elt"
|
|
65
65
|
Provides-Extra: all
|
|
66
66
|
Requires-Dist: aggregate[elt,massive,notebook,numba,viz]; extra == "all"
|
|
67
67
|
Dynamic: license-file
|
|
@@ -115,7 +115,7 @@ viz = [
|
|
|
115
115
|
# import. A `uv sync` replaces a local eltq build with the published wheel, so
|
|
116
116
|
# re-install a checkout after syncing to test an unreleased change.
|
|
117
117
|
elt = [
|
|
118
|
-
"eltq>=2.
|
|
118
|
+
"eltq>=2.15",
|
|
119
119
|
]
|
|
120
120
|
# Every user-facing extra in one shot. Self-referencing so the lists cannot
|
|
121
121
|
# drift; deliberately excludes `dev` (docs build and test tooling).
|
|
@@ -61,7 +61,7 @@ __status__ = "beta"
|
|
|
61
61
|
# The one place the version is written. A plain literal on purpose: setuptools
|
|
62
62
|
# reads it statically for the wheel, and running code reports it live, so an
|
|
63
63
|
# editable install never reports a stale number after a bump.
|
|
64
|
-
__version__ = "2.
|
|
64
|
+
__version__ = "2.1.0"
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
__doc__ = """
|
|
@@ -8477,8 +8477,7 @@ class Aggregate(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
8477
8477
|
reins_view=reins_view)
|
|
8478
8478
|
|
|
8479
8479
|
def calibrate_distortions(self, coc=None, *, lr=None, p=None, a=None,
|
|
8480
|
-
kind='lower',
|
|
8481
|
-
names=_pricing.DEFAULT_CALIBRATION_DISTORTIONS,
|
|
8480
|
+
kind='lower', names=None, extended=False,
|
|
8482
8481
|
reins_view=None):
|
|
8483
8482
|
"""Calibrate the standard pricing distortion set to a pricing target.
|
|
8484
8483
|
|
|
@@ -8505,6 +8504,12 @@ class Aggregate(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
8505
8504
|
Asset level; snapped to the grid. Exactly one of ``p`` or ``a``.
|
|
8506
8505
|
kind : {'lower', 'upper'}, optional
|
|
8507
8506
|
VaR kind when ``p`` is provided. Default ``'lower'``.
|
|
8507
|
+
names : sequence of str, optional
|
|
8508
|
+
The distortion families to calibrate, in order. Default ``None``,
|
|
8509
|
+
the standard set ``ccoc``, ``ph``, ``wang``, ``dual``, ``tvar``.
|
|
8510
|
+
extended : bool, default False
|
|
8511
|
+
Calibrate the extended set, the standard set with ``tsallis``
|
|
8512
|
+
between ``wang`` and ``dual``. Raises ``ValueError`` with ``names``.
|
|
8508
8513
|
reins_view : str, optional
|
|
8509
8514
|
Which of a cession's distributions to calibrate on, one of
|
|
8510
8515
|
:attr:`reins_views`. The default ``None`` is this aggregate's own
|
|
@@ -8515,8 +8520,8 @@ class Aggregate(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
8515
8520
|
Returns
|
|
8516
8521
|
-------
|
|
8517
8522
|
CalibrationResult
|
|
8518
|
-
Carrying ``distortion_df`` (one row per
|
|
8519
|
-
``[ccoc, ph, wang, dual, tvar]``), the shared one-row
|
|
8523
|
+
Carrying ``distortion_df`` (one row per calibrated family, by
|
|
8524
|
+
default ``[ccoc, ph, wang, dual, tvar]``), the shared one-row
|
|
8520
8525
|
``calibration_df`` target, the ``distortions`` themselves, and the
|
|
8521
8526
|
inputs they were fitted at. The same three are stored on
|
|
8522
8527
|
``self.distortion_df`` / ``self.calibration_df`` /
|
|
@@ -8555,6 +8560,7 @@ class Aggregate(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
8555
8560
|
"""
|
|
8556
8561
|
return _pricing.calibrate_distortions(self, coc, lr=lr, p=p, a=a,
|
|
8557
8562
|
kind=kind, names=names,
|
|
8563
|
+
extended=extended,
|
|
8558
8564
|
reins_view=reins_view)
|
|
8559
8565
|
|
|
8560
8566
|
def evaluate(self, P=None, *, p=None, a=None, names=None,
|
|
@@ -8564,7 +8570,7 @@ class Aggregate(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
8564
8570
|
Pricing asks what the obligation is worth; evaluation asks how much
|
|
8565
8571
|
stress the position you hold survives. Solves, per distortion family,
|
|
8566
8572
|
for the shape at which the risk-adjusted margin reaches 0. The
|
|
8567
|
-
breakeven ``
|
|
8573
|
+
breakeven ``gini`` is the family-agnostic acceptability index of
|
|
8568
8574
|
Cherny and Madan.
|
|
8569
8575
|
|
|
8570
8576
|
Parameters
|
|
@@ -8601,7 +8607,7 @@ class Aggregate(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
8601
8607
|
Carrying ``evaluation_df``, the panel: tidy (long) form,
|
|
8602
8608
|
``MultiIndex`` rows ``(Step, distortion)`` with ``Step`` this
|
|
8603
8609
|
aggregate's name, and columns ``role`` / ``param_name`` /
|
|
8604
|
-
``param`` / ``
|
|
8610
|
+
``param`` / ``gini`` / ``error`` / ``status``. ``role`` is
|
|
8605
8611
|
always ``'sell'`` here: an aggregate is an obligation written, so
|
|
8606
8612
|
the position is held the way it is booked. The same shape
|
|
8607
8613
|
:meth:`PnL.evaluate` and :meth:`Portfolio.evaluate` return, so
|
|
@@ -58,9 +58,9 @@ MAX_EXAMPLES = 5
|
|
|
58
58
|
ELT_FORMS = {3: 'ELT3', 4: 'ELT4', 6: 'ELT6'}
|
|
59
59
|
YELT_FORMS = {2: 'YELT2', 3: 'YELT3'}
|
|
60
60
|
|
|
61
|
-
#: The oldest eltq with every function the ELT6 path calls; 2.
|
|
62
|
-
#: ``
|
|
63
|
-
ELTQ_MIN_VERSION = (2,
|
|
61
|
+
#: The oldest eltq with every function the ELT6 path calls; 2.15.0 added
|
|
62
|
+
#: ``density_arrays``, the severity's ``pdf``.
|
|
63
|
+
ELTQ_MIN_VERSION = (2, 15, 0)
|
|
64
64
|
|
|
65
65
|
#: Relative tolerance on the shared-event moment integration, eltq's
|
|
66
66
|
#: ``multiunit_moments`` ``rtol`` on ``C_2`` and ``C_3``, under the Burke rule.
|
|
@@ -3336,13 +3336,13 @@ class PnL(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3336
3336
|
|
|
3337
3337
|
A P&L is **evaluated, not priced**: you ask which distortion drives the
|
|
3338
3338
|
risk-adjusted margin to zero, the breakeven stress the position
|
|
3339
|
-
survives. The breakeven ``
|
|
3339
|
+
survives. The breakeven ``gini`` is the single family-agnostic
|
|
3340
3340
|
acceptability index (Cherny & Madan).
|
|
3341
3341
|
|
|
3342
3342
|
Every **margin row of the ledger** is evaluated, not just the grand
|
|
3343
3343
|
result, so a tower reads as a story: the gross deal, each reinsurance
|
|
3344
3344
|
layer as a position in its own right, and the running net after each
|
|
3345
|
-
purchase. Reading a ``
|
|
3345
|
+
purchase. Reading a ``gini`` column down the ``net through ...`` rows
|
|
3346
3346
|
is watching what buying cover does to the deal.
|
|
3347
3347
|
|
|
3348
3348
|
A ceded layer is evaluated **from the seller's side** (:meth:`_row_role`
|
|
@@ -3351,7 +3351,7 @@ class PnL(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3351
3351
|
column says which rows those are: ``buy`` for a cession, ``sell`` for a
|
|
3352
3352
|
book written, ``net`` for a running net or the grand result, which net
|
|
3353
3353
|
the two against each other. That is what makes the panel a buy decision:
|
|
3354
|
-
a layer whose ``
|
|
3354
|
+
a layer whose ``gini`` sits **above** the ``net`` row immediately over
|
|
3355
3355
|
it is priced above the holder's own acceptability, so buying it lowers
|
|
3356
3356
|
the net, and one below it raises the net.
|
|
3357
3357
|
|
|
@@ -3373,7 +3373,7 @@ class PnL(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3373
3373
|
EvaluationResult
|
|
3374
3374
|
Carrying ``evaluation_df``, the panel: tidy (long) form,
|
|
3375
3375
|
``MultiIndex`` rows ``(Step, distortion)`` and columns ``role`` /
|
|
3376
|
-
``param_name`` / ``param`` / ``
|
|
3376
|
+
``param_name`` / ``param`` / ``gini`` / ``error`` / ``status``.
|
|
3377
3377
|
``.unstack('distortion')`` on it gives the wide comparison view.
|
|
3378
3378
|
``premium`` on the result is ``None``: every ledger row carries
|
|
3379
3379
|
its own consideration and no single number stands for them.
|
|
@@ -3563,8 +3563,7 @@ class Portfolio(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3563
3563
|
return _density.add_exa(self, df, unit_state)
|
|
3564
3564
|
|
|
3565
3565
|
def calibrate_distortions(self, coc=None, *, lr=None, p=None, a=None,
|
|
3566
|
-
kind='lower',
|
|
3567
|
-
names=_pricing.DEFAULT_CALIBRATION_DISTORTIONS,
|
|
3566
|
+
kind='lower', names=None, extended=False,
|
|
3568
3567
|
reins_view=None):
|
|
3569
3568
|
"""
|
|
3570
3569
|
Calibrate the standard pricing distortion set to a pricing target.
|
|
@@ -3587,6 +3586,12 @@ class Portfolio(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3587
3586
|
must be provided.
|
|
3588
3587
|
kind : {'lower', 'upper'}, optional
|
|
3589
3588
|
VaR kind when ``p`` is provided. Default ``'lower'``.
|
|
3589
|
+
names : sequence of str, optional
|
|
3590
|
+
The distortion families to calibrate, in order. Default ``None``,
|
|
3591
|
+
the standard set ``ccoc``, ``ph``, ``wang``, ``dual``, ``tvar``.
|
|
3592
|
+
extended : bool, default False
|
|
3593
|
+
Calibrate the extended set, the standard set with ``tsallis``
|
|
3594
|
+
between ``wang`` and ``dual``. Raises ``ValueError`` with ``names``.
|
|
3590
3595
|
reins_view : str, optional
|
|
3591
3596
|
Which of the book's reinsurance views to calibrate on, one of
|
|
3592
3597
|
:attr:`reins_views` (``gross`` / ``ceded`` / ``net``). The default
|
|
@@ -3598,13 +3603,13 @@ class Portfolio(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3598
3603
|
-------
|
|
3599
3604
|
CalibrationResult
|
|
3600
3605
|
Carrying the per-distortion calibration receipt ``distortion_df``
|
|
3601
|
-
(also stored on ``self.distortion_df``): one row per
|
|
3602
|
-
``[ccoc, ph, wang, dual, tvar]``, index named ``distortion`` (an
|
|
3606
|
+
(also stored on ``self.distortion_df``): one row per calibrated
|
|
3607
|
+
family, by default ``[ccoc, ph, wang, dual, tvar]``, index named ``distortion`` (an
|
|
3603
3608
|
ordered categorical, canonical sort), columns
|
|
3604
|
-
``[param_name, param, error,
|
|
3609
|
+
``[param_name, param, error, gini, area]``. ``param`` is the raw
|
|
3605
3610
|
shape (``param_name`` says what it is per family); ``error`` is the
|
|
3606
|
-
premium miss; ``
|
|
3607
|
-
``= 2∫g−1 = p_equiv`` (TVaR-equivalent level); ``area = (
|
|
3611
|
+
premium miss; ``gini`` is the comparable normalised shape
|
|
3612
|
+
``= 2∫g−1 = p_equiv`` (TVaR-equivalent level); ``area = (gini+1)/2
|
|
3608
3613
|
= ∫g``. The result also carries ``calibration_df``, the
|
|
3609
3614
|
``distortions``, the inputs, and the lazily computed allocation of
|
|
3610
3615
|
the target across units (``pricing_df``).
|
|
@@ -3637,6 +3642,7 @@ class Portfolio(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3637
3642
|
"""
|
|
3638
3643
|
return _pricing.calibrate_distortions(self, coc, lr=lr, p=p, a=a,
|
|
3639
3644
|
kind=kind, names=names,
|
|
3645
|
+
extended=extended,
|
|
3640
3646
|
reins_view=reins_view)
|
|
3641
3647
|
|
|
3642
3648
|
def evaluate(self, P=None, *, unit='total', p=None, a=None, names=None,
|
|
@@ -3689,7 +3695,7 @@ class Portfolio(HelpMixin, LabeledMixin, ProgramMixin):
|
|
|
3689
3695
|
Carrying ``evaluation_df``, the panel: tidy (long) form,
|
|
3690
3696
|
``MultiIndex`` rows ``(Step, distortion)``, one ``Step`` per
|
|
3691
3697
|
evaluated unit, and columns ``role`` / ``param_name`` / ``param`` /
|
|
3692
|
-
``
|
|
3698
|
+
``gini`` / ``error`` / ``status``. ``role`` is always ``'sell'``:
|
|
3693
3699
|
every unit is an obligation written. With a ``reins_view`` each
|
|
3694
3700
|
``Step`` is suffixed by it, so panels for several views concatenate
|
|
3695
3701
|
without collapsing.
|
|
@@ -23,6 +23,9 @@ from .results import CalibrationResult
|
|
|
23
23
|
|
|
24
24
|
# The standard pricing distortion set calibrated by ``calibrate_distortions``.
|
|
25
25
|
DEFAULT_CALIBRATION_DISTORTIONS = ('ccoc', 'ph', 'wang', 'dual', 'tvar')
|
|
26
|
+
# The standard set with ``tsallis`` in registry order, between ``wang`` and
|
|
27
|
+
# ``dual``.
|
|
28
|
+
EXTENDED_CALIBRATION_DISTORTIONS = ('ccoc', 'ph', 'wang', 'tsallis', 'dual', 'tvar')
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
def guard_unbounded_anchor(obj, p, *, where):
|
|
@@ -702,12 +705,12 @@ def _calibration_frames(dists, coc, p_val, Fa, exa, P, a):
|
|
|
702
705
|
for dname in names:
|
|
703
706
|
dist = dists[dname]
|
|
704
707
|
# param_name is the family's natural parameter ('a', 'lam', 'b', 'p');
|
|
705
|
-
# ccoc has none -> 'r'.
|
|
706
|
-
rows.append([_param_name(dist), dist.shape, dist.error, dist.
|
|
707
|
-
(dist.
|
|
708
|
+
# ccoc has none -> 'r'. gini = 2∫g - 1 (= p_equiv); area = ∫g.
|
|
709
|
+
rows.append([_param_name(dist), dist.shape, dist.error, dist.gini,
|
|
710
|
+
(dist.gini + 1) / 2])
|
|
708
711
|
distortion_df = pd.DataFrame(
|
|
709
712
|
rows,
|
|
710
|
-
columns=['param_name', 'param', 'error', '
|
|
713
|
+
columns=['param_name', 'param', 'error', 'gini', 'area'],
|
|
711
714
|
index=pd.CategoricalIndex(names, dtype=DISTORTION_DTYPE, name='distortion'),
|
|
712
715
|
)
|
|
713
716
|
calibration_df = complete_pentagon(
|
|
@@ -817,12 +820,18 @@ def _coc_from_lr(L, a, lr):
|
|
|
817
820
|
|
|
818
821
|
|
|
819
822
|
def calibrate_distortions(obj, coc=None, *, lr=None, p=None, a=None,
|
|
820
|
-
kind='lower',
|
|
821
|
-
names=DEFAULT_CALIBRATION_DISTORTIONS,
|
|
823
|
+
kind='lower', names=None, extended=False,
|
|
822
824
|
reins_view=None):
|
|
823
825
|
"""Calibrate the standard pricing distortion set to a pricing target on a
|
|
824
826
|
single distribution (an ``Aggregate`` or a ``Portfolio`` total).
|
|
825
827
|
|
|
828
|
+
**The families** are ``names`` when given, and otherwise
|
|
829
|
+
:data:`DEFAULT_CALIBRATION_DISTORTIONS`, or
|
|
830
|
+
:data:`EXTENDED_CALIBRATION_DISTORTIONS` with ``extended=True``, which adds
|
|
831
|
+
``tsallis`` between ``wang`` and ``dual``. ``names`` together with
|
|
832
|
+
``extended=True`` raises ``ValueError``: the two choose the same thing, and
|
|
833
|
+
ignoring either would hide a mistake.
|
|
834
|
+
|
|
826
835
|
Resolves the asset level ``a`` (from ``p`` or given), the expected loss
|
|
827
836
|
``exa = E[min(X, a)]`` and the premium target ``P`` (from ``coc`` via the
|
|
828
837
|
ROE -> LR -> P inversion), then calls :meth:`Distortion.calibrate_set` once.
|
|
@@ -913,6 +922,13 @@ def calibrate_distortions(obj, coc=None, *, lr=None, p=None, a=None,
|
|
|
913
922
|
artifact of the grid, so the reader means the loss ratio on the premium
|
|
914
923
|
they are shown.
|
|
915
924
|
"""
|
|
925
|
+
if names is None:
|
|
926
|
+
names = (EXTENDED_CALIBRATION_DISTORTIONS if extended
|
|
927
|
+
else DEFAULT_CALIBRATION_DISTORTIONS)
|
|
928
|
+
elif extended:
|
|
929
|
+
raise ValueError(
|
|
930
|
+
'calibrate_distortions takes names= or extended=True, not both: '
|
|
931
|
+
f'extended=True is the families {EXTENDED_CALIBRATION_DISTORTIONS}.')
|
|
916
932
|
if (p is None) == (a is None):
|
|
917
933
|
raise ValueError(
|
|
918
934
|
'calibrate_distortions requires exactly one of p= (probability) '
|
|
@@ -1087,8 +1103,8 @@ EVAL_SIGN = {'sell': 1.0, 'buy': -1.0, 'net': 1.0}
|
|
|
1087
1103
|
#: ``(step, family)``: ``param`` holds each family's own natural parameter, so
|
|
1088
1104
|
#: it is a pure column only at this grain. ``role`` leads because it qualifies
|
|
1089
1105
|
#: the whole row, naming whose position the parameters describe.
|
|
1090
|
-
#: ``area = (
|
|
1091
|
-
EVAL_COLS = ['role', 'param_name', 'param', '
|
|
1106
|
+
#: ``area = (gini + 1) / 2`` is not carried, being a restatement of ``gini``.
|
|
1107
|
+
EVAL_COLS = ['role', 'param_name', 'param', 'gini', 'error', 'status']
|
|
1092
1108
|
|
|
1093
1109
|
|
|
1094
1110
|
def _eval_sign(role):
|
|
@@ -1118,7 +1134,7 @@ def evaluate_margin(gd, *, role='sell', names=None):
|
|
|
1118
1134
|
|
|
1119
1135
|
Solves, per distortion family, for the shape at which the risk-adjusted
|
|
1120
1136
|
margin reaches 0: the most stress the position survives. The breakeven
|
|
1121
|
-
``
|
|
1137
|
+
``gini`` is the family-agnostic acceptability index.
|
|
1122
1138
|
|
|
1123
1139
|
Parameters
|
|
1124
1140
|
----------
|
|
@@ -1329,7 +1345,7 @@ def _evaluate_margin_arrays(x, p, bs, *, role='sell', names=None):
|
|
|
1329
1345
|
rows = []
|
|
1330
1346
|
for nm in names:
|
|
1331
1347
|
d = dists[nm]
|
|
1332
|
-
rows.append([role, _param_name(d), d.shape, d.
|
|
1348
|
+
rows.append([role, _param_name(d), d.shape, d.gini, d.error, 'ok'])
|
|
1333
1349
|
return _eval_panel(rows, names)
|
|
1334
1350
|
|
|
1335
1351
|
|
|
@@ -214,6 +214,73 @@ def make_ceder_netter(reins_list, debug=False):
|
|
|
214
214
|
return ceder, netter
|
|
215
215
|
|
|
216
216
|
|
|
217
|
+
def flat_run_end(reins_list, view, x, tol=1e-9):
|
|
218
|
+
"""Right end of the stretch on which the net or ceded loss is constant at ``x``.
|
|
219
|
+
|
|
220
|
+
Parameters
|
|
221
|
+
----------
|
|
222
|
+
reins_list : list of (share, limit, attach)
|
|
223
|
+
The program, validated as :func:`make_ceder_netter` validates it.
|
|
224
|
+
view : {'net', 'ceded'}
|
|
225
|
+
Which function of the subject loss.
|
|
226
|
+
x : float or array_like
|
|
227
|
+
Subject (gross) losses, nonnegative.
|
|
228
|
+
tol : float
|
|
229
|
+
Tolerance for joining two stretches that touch.
|
|
230
|
+
|
|
231
|
+
Returns
|
|
232
|
+
-------
|
|
233
|
+
numpy.ndarray
|
|
234
|
+
For each ``x``, :math:`r = \\sup\\{u : g(u) \\le g(x)\\}` with
|
|
235
|
+
:math:`g` the net or ceded function: the right end of the stretch of
|
|
236
|
+
constant :math:`g` containing ``x``, ``inf`` when :math:`g` stays
|
|
237
|
+
constant to infinity, and ``x`` itself where :math:`g` increases.
|
|
238
|
+
|
|
239
|
+
Notes
|
|
240
|
+
-----
|
|
241
|
+
With shares at most 100% and layers that do not overlap, both functions
|
|
242
|
+
are nondecreasing and piecewise linear, so :math:`\\{g(X) > g(x)\\} =
|
|
243
|
+
\\{X > r\\}` and :math:`\\Pr(g(X) > g(x)) = S(r)`. The net function is
|
|
244
|
+
constant across a layer placed at 100%. The ceded function is constant
|
|
245
|
+
below the first attachment, across a gap or a zero share layer, and above
|
|
246
|
+
the top of a finite program. Stretches that touch, such as two contiguous
|
|
247
|
+
layers at 100%, are joined. The stretches are read from the layer tuples
|
|
248
|
+
rather than from the knots of :func:`make_ceder_netter`, whose stand-in
|
|
249
|
+
for infinity loses the net function's value at an unlimited layer.
|
|
250
|
+
"""
|
|
251
|
+
if view not in ('net', 'ceded'):
|
|
252
|
+
raise ValueError(f"view must be 'net' or 'ceded', not {view!r}")
|
|
253
|
+
_validate_reins_layers(reins_list)
|
|
254
|
+
flat = []
|
|
255
|
+
top = 0.0
|
|
256
|
+
for share, limit, attach in reins_list:
|
|
257
|
+
end = attach + limit
|
|
258
|
+
if view == 'net' and share >= 1:
|
|
259
|
+
flat.append((attach, end))
|
|
260
|
+
elif view == 'ceded':
|
|
261
|
+
if attach > top:
|
|
262
|
+
flat.append((top, attach))
|
|
263
|
+
if share <= 0:
|
|
264
|
+
flat.append((attach, end))
|
|
265
|
+
top = end
|
|
266
|
+
if view == 'ceded':
|
|
267
|
+
if not reins_list:
|
|
268
|
+
flat.append((0.0, np.inf))
|
|
269
|
+
elif np.isfinite(top):
|
|
270
|
+
flat.append((top, np.inf))
|
|
271
|
+
runs = []
|
|
272
|
+
for lo, hi in sorted(flat):
|
|
273
|
+
if runs and lo <= runs[-1][1] + tol:
|
|
274
|
+
runs[-1][1] = max(runs[-1][1], hi)
|
|
275
|
+
else:
|
|
276
|
+
runs.append([lo, hi])
|
|
277
|
+
x = np.asarray(x, dtype=float)
|
|
278
|
+
r = x.copy()
|
|
279
|
+
for lo, hi in runs:
|
|
280
|
+
r = np.where((x >= lo) & (x <= hi), np.maximum(r, hi), r)
|
|
281
|
+
return r
|
|
282
|
+
|
|
283
|
+
|
|
217
284
|
# ====================================================================
|
|
218
285
|
# Apply engine: ceder/netter convolution onto the model grid
|
|
219
286
|
# ====================================================================
|