Module 7 · Probability Distributions and Simulation Basics Lesson 63 of 120

Poisson Distribution and Event Counts

Modeling event counts over a stated exposure interval.

2:35 clip3:22:15–3:24:50 in the full courseWatch on YouTube

Transcript

21 sentences · select one to jump there

Check your understanding

Does lambda=2 mean two events per every possible time unit?

Choose one answer

Code lab

Run it yourself

The lesson source in 7 languages. Edit it, run TypeScript and Python right here, and compare with the expected output.

063-poisson-distribution-and-event-counts.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 063 of 120
 * Poisson Distribution and Event Counts
 * Module 07: Probability Distributions and Simulation Basics
 *
 * Scenario: Modeling event counts over a stated exposure interval
 * Rule:     P(K=k)=exp(−λ)λᵏ/k!
 *
 * Try it:   Does lambda=2 mean two events per every possible time unit?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/probability-distributions-and-simulation-basics/poisson-distribution-and-event-counts/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson063() {
  const lambda=2;
  const result={zero:Math.exp(-lambda),
    exactlyThree:Math.exp(-lambda)*lambda**3/6,
    mean:lambda,variance:lambda};
  return result;
}

export const checkedResult = {"zero":0.1353352832366127,"exactlyThree":0.1804470443154836,"mean":2,"variance":2};

// Run this file directly: npx tsx lessons/07-probability-distributions-and-simulation-basics/063-poisson-distribution-and-event-counts.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson063(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "zero": 0.1353352832366127,
  "exactlyThree": 0.1804470443154836,
  "mean": 2,
  "variance": 2
}

Prefer your own machine? Every file is in the course repository · open it in Codespaces.

Lesson notes

The rule

P(K=k)=exp(−λ)λᵏ/k!