Module 6 · Probability and Random Variables Lesson 51 of 120

Experiments, Outcomes, Sample Spaces, and Events

Defining what can happen to a payment.

2:31 clip2:44:52–2:47:23 in the full courseWatch on YouTube

Transcript

22 sentences · select one to jump there

Check your understanding

Is not declined identical to approved in this model?

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.

051-experiments-outcomes-sample-spaces-and-events.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 051 of 120
 * Experiments, Outcomes, Sample Spaces, and Events
 * Module 06: Probability and Random Variables
 *
 * Scenario: Defining what can happen to a payment
 * Rule:     event A ⊆ sample space Ω
 *
 * Try it:   Is not declined identical to approved in this model?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/probability-and-random-variables/experiments-outcomes-sample-spaces-and-events/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson051() {
  const outcomes = ["approved","review","declined"];
  const probabilities = [.80,.05,.15];
  const notDeclined = probabilities
    .filter((_, i) => outcomes[i] !== "declined")
    .reduce((s,p)=>s+p,0);
  const result = {total: probabilities.reduce((s,p)=>s+p,0), notDeclined};
  return result;
}

export const checkedResult = {"total":1,"notDeclined":0.8500000000000001};

// Run this file directly: npx tsx lessons/06-probability-and-random-variables/051-experiments-outcomes-sample-spaces-and-events.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson051(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "total": 1,
  "notDeclined": 0.8500000000000001
}

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

Lesson notes

The rule

event A ⊆ sample space Ω