I’m building a monte carlo simulator right now. This means that what I’m really doing is:

- Pick my statistical distributions
- Figure out a way of generating random numbers from those distributions.

For my (reinsurance) purposes, I am trying to answer the following questions: how many claims are there and what do they cost?

So I’ve learned to just model the frequency of claims with a poisson distribution and the severity of claims with something else: Lognormal, Beta, InverseGauss (the last is our favorite because it’s so damn obscure).

It’s one thing to use something like @risk, which has all the distributions packaged up, but what if you don’t HAVE @risk and you’re too cheap to buy it?

Well, you roll up your sleeves and find something on the Internet is what.

A problem here is that math is mostly written in another language. Here’s the formula for evaluating the probability of k things happening if you’re expecting lambda things happening:

Oh, says Donald Knuth, well you can generate random numbers for that with this:

**algorithm** *poisson random number (Knuth)*:
**init**:
**Let** L ← *e*

^{−λ}

, k ← 0 and p ← 1.
**do**:
k ← k + 1.
Generate uniform random number u in [0,1] and **let** p ← p × u.
**while** p > L.
**return** k − 1.

Right. Well, neither of these languages is English.

That Knuth program is super interesting, though, because I feel like its constituent ideas are within my grasp. What it’s saying is that you multiply two random numbers between 0 and 1 together. If that number is higher than e^(-lambda), you multiply another. Then check again and continue until you have a number that is smaller than the e^(-lambda) threshold.

We all know the probability of two things happening together is their probability multiplied together. So each of these 0-1 random numbers has an expected value of 0.5. If you multiplied 30 of these together, because you’re expecting 30 as your lambda, you get 0.5^30.

But the distribution isn’t uniform. The higher the lambda, the bigger the left side of the distribution and so mean value sits at a progressively higher percentile. Put another way, the ratio of 0.5^lambda / e^-lambda increases.

I’m still stumped, though. I don’t understand e well enough to figure out what it’s doing to this whole thing and I want to go to bed.

Perhaps more tomorrow!

### Like this:

Like Loading...

*Related*

## One thought on “What IS The Poisson Distribution, Anyway?”