Skip to main content
Supply policy contexts and quote records to PremiumAnalysis. Each method returns typed rows; to_pandas() produces a detached table for charts.

Supply the records

These quotes are synthetic annual premiums. Policy B represents two policies, and policy C has a population row only:
Choose every term field your comparison needs. Matching fields declare equality; source and wording review establish suitability. Use RatingSource("rater_bundle", bundle_id) for compiled rater outputs.

Reuse a book or native rating results

PremiumAnalysis.from_book(book, quotes, ...) pairs supplied quotes with every submission of a Book or Study. PremiumAnalysis.from_market(results, book, ...) converts policy-level Market.rate rows. Both map submission columns through segments, weight, profile, exposure, losses and claim_count, and keep unquoted submissions in the population. The from_market callback terms returns each successful row’s PremiumTerms. Model a commercial book uses from_market with a payroll exposure base and a calibrated mix.

Inspect policy comparisons

Policy C stays in the population as unrated. pair_results() returns each policy’s two quotes, and check_comparability() lists each term difference.

Summarize the population

The totals use positive-weight comparable policies, so B counts twice. summarize(by=("size",)) returns one summary per segment, and each scenario and draw keeps its own summary.

Apply another mix

Supply one Decimal count weight per policy context:
The new weights reuse each policy’s quotes. analysis.calibrate(targets) derives the weights from target counts by segment. Changed rating inputs require updated quotes.

Inspect a term mismatch

Give the alternative a higher deductible:
Each mismatched policy keeps its quotes with the status basis_mismatch, and its premium change is None.

Count what was rated

Each program’s counts separate succeeded, ineligible, unratable and unattempted contexts, with reason-code counts. Report them beside every result.

Show the distribution of changes

A percentile is the smallest observed change whose cumulative weight share reaches the level. Buckets include their lower edge. The alternative is cheaper for 95% of baseline premium, because it prices the larger policy lower.

Compare premium with losses

double_lift sorts paired policies by price ratio, candidate over baseline premium, and compares each group’s actual losses with both programs’ premium. Supply losses as PolicyExposure.losses, or with from_book(losses=...):
The alternative is cheaper where the current loss ratio is 90%, and dearer where it is 60%. Losing the cheaper group would improve the current book. Low current loss ratios in the cheaper groups would mark profitable business at risk. Omit edges for equal-weight groups, and add claim_count for each group’s credibility.

Spread across simulated draws

When a Study fills unknown risk facts, each draw rates its own version of the book. draw_ranges summarizes every draw, then reports quantiles across draws:
Draw 0 is the reported book, with its blanks unfilled; pass include_draw_zero=True to include it. These quantiles describe the spread of draws, rather than confidence intervals. Model an unknown that applies to a whole program, such as a redacted factor, as separate low, middle and high scenarios. Drawing it policy by policy averages it away.

Rank several programs

Shares and totals use the policies every program quoted. ranking.to_pandas() shows each policy’s rank and its gap to the cheapest program. The analysis reference lists the typed records, methods, and dataframe functions.