1. Tutorials

Tutorials explain what each object does. They provide the background to start getting stuff done. The two most important classes in the library are Aggregate, which models a single unit (unit refers to a line of business, business unit, geography, operating division, etc.), and a Portfolio which models multiple units. The Portfolio broadly includes all the functionality in Aggregate and adds capabilities for price allocation and price functional calibration. Supporting these two are the Severity class, modeling size of loss, and the Underwriter class that keeps track of everything and acts as a helper.

Aggregate and Portfolio objects both have the following attributes and functions.

  • A density_df dataframe containing the relevant probability distributions and other information.

  • A report_df providing a building block summary.

  • A plot method to visualize the underlying distributions.

  • An update method, to trigger the numerical calculation of probability distributions.

  • A spec dictionary, containing the input information needed to recreate each object. For example, if ag is an Aggregate object, then Aggregate(**ag.spec) creates a new copy.

  • log2 and bs

Second-level attributes:

  • A statistics_df and statistics_total_df dataframes with theoretically derived statistical moments (mean, variance, CV, sknewness, etc.)

  • An audit_df with information to check if the numerical approximations appear valid. Numerically computed statistics are prefaced emp_.

Tutorial 1: Creating, updating, plotting and inspecting an Aggregate object

How Expected Claim Count is determined

  • en determines en

  • prem x loss ratio -> el

  • severity x en -> el

  • always have en and el; may have prem and exp_lr

  • if prem then exp_lr computed

  • if exp_lr then premium computed

  • el is determined using np.where(el==0, prem*exp_lr, el)

  • if el==0 then el = freq * sev

  • assert np.all( el>0 or en>0 )

  • call with el (or prem x exp_lr) (or n) expressing a mixture, with the same severity

  • call with el expressing lines of business with an array of severities

  • call with single el and array of sevs expressing a mixture; [] broken down by weights

Conditional and Unconditional Severity

  • n is the CONDITIONAL claim count

  • X is the GROUND UP severity, so X | X > attachment is used and generates n claims