The general attribution primitive: for every insured unit, determines which peril(s) caused its indemnity by matching Summary of Business unit experience to cause-of-loss records (see the cascade described under identify_pp_units(), which is the prevented-planting specialization of this function). Any column of the cause-of-loss records can serve as the taxonomy (cause_var), e.g. damage_name_recode, damage_cause_code, or stage_code.

identify_cause_of_loss(
  sobtpu,
  colsom,
  stage_listing,
  universe = NULL,
  cause_var = "damage_name_recode",
  plans = c(1:3, 90),
  exclude_cat = TRUE,
  prorate = TRUE,
  split_pp = FALSE,
  pp_pattern = "Prevented",
  buyup_map = c(PF = "05", PT = "10")
)

Arguments

sobtpu

Unit-level Summary of Business (modern rfcip names).

colsom

Cause-of-loss records matched to the Summary of Business.

stage_listing

Stage-code listing (stage_code, stage_code_description); joined for completeness of the taxonomy.

universe

Optional table (e.g. a provision's actuarial records) whose identifier columns restrict both sides to covered pools.

cause_var

Column of colsom defining the cause taxonomy.

plans

Insurance plan codes retained.

exclude_cat

Drop catastrophic coverage.

prorate

Prorate unresolved pools by residual indemnity shares.

split_pp

Interact the taxonomy with the loss type: each cause becomes <cause>|pp (Prevented stages) or <cause>|prod (all other stages), and buyup_shares is returned.

pp_pattern

Regular expression identifying prevented-planting stages in stage_code_description (used when split_pp).

buyup_map

Named character vector mapping buy-up stage codes to election labels ("05", "10"); used when split_pp.

Value

A list of data.tables keyed by unit_uid (internal to one call; ship the set together):

units

the filtered sobtpu rows plus unit_uid, col_status, col_status_label, primary_cause, primary_cause_share

cause_shares

long unit_uid x cause: share_indem (the unit's indemnity share by cause; matched shares for resolved units, pool prorate for unresolved) and share_acres (pool-level share of determined acres by cause). Shares sum to one within a unit.

buyup_shares

when split_pp, long unit_uid x buyup ("05"/"10"): the unit's indemnity share in buy-up Prevented stages (same resolution logic as cause_shares); nests inside the |pp cause shares, so basic PP is recoverable by subtraction. NULL otherwise.