# Claims 1: Claim Frequency

Source: https://obsvra.com/learn/modeling-101/modeling-lesson-claims-1

**Uses Only Free-Tier SpiceGrinder**

### Problem statement

Underwriting and claims analytics teams need volume: large numbers of realistic claim counts and dollar amounts to stress-test pricing models, reserve calculations, and reporting pipelines. Real claims data can't do this job well — even if you ignore that it's probably full of policyholder PII that can't leave a controlled environment, it only ever shows you losses that have _already_ happened, never the catastrophe cluster or inflation shock your capital model needs to be tested against before it happens for real.

### The model

How many claims land in a period is a count — a `Poisson` distribution, the standard choice for "some number of discrete events happen at some average rate." How large each claim is, is a differently-shaped question: claim sizes are never symmetric, they cluster around a typical value and then stretch out into a long tail of expensive ones — a `Lognormal`. The model defines these and then uses an `Append` filter to combine them into a single observation.

```
<?xml version="1.0" encoding="UTF-8"?>
<dataset columns="claimCount, severity" seed="42">
  <root node="ClaimObservation"/>
  <nodes>
    <Append name="ClaimObservation">
      <input name="Frequency"/>
      <input name="Severity"/>
    </Append>
    <Poisson name="Frequency" lambda="3.5"/>
    <Lognormal name="Severity" mu="8.0" sigma="1.2"/>
  </nodes>
</dataset>
```

Run it (`samples/financial/claims-frequency-severity.xml` in your own install, if you want to reproduce this) and you get pairs of `(count, amount)` (exactly these values if you leave the seed at 42):

```
5,7411.46203012888
2,15323.028678898674
3,13875.965680698899
1,1320.8613862135312
6,5546.455493342504
4,5809.677891177162
1,1940.0335823135702
2,7375.552486392491
```

### Why this shape, and not another

Poisson only ever produces non-negative integers — you cannot get a `-2` claim count out of it, which is the whole point of choosing it over, say, a `Normal` you'd have to remember to clamp and round yourself. Lognormal only ever produces positive numbers too, and it does so with the heavy right tail severity actually has: a few outsized claims pulling the mean well above the median, which is what real severity distributions look like and what something like a `Normal` distribution would get wrong.

The choices of `lambda="3.5"` or `mu="8.0" sigma="1.2"` are there as an example. If you're using this model for your own purposes, you can change those parameters to match your data.
