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

Exponential, Gamma, and Weibull Waiting-Time Models

Waiting for an event, several stages, or an aging failure process.

2:36 clip3:35:24–3:38:00 in the full courseWatch on YouTube

Transcript

18 sentences · select one to jump there

Check your understanding

Does equal survival probability at one time make two models equivalent?

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.

068-exponential-gamma-and-weibull-waiting-time-models.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 068 of 120
 * Exponential, Gamma, and Weibull Waiting-Time Models
 * Module 07: Probability Distributions and Simulation Basics
 *
 * Scenario: Waiting for an event, several stages, or an aging failure process
 * Rule:     Exponential S(t)=exp(−t/scale); Weibull S(t)=exp(−(t/scale)^shape)
 *
 * Try it:   Does equal survival probability at one time make two models equivalent?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/probability-distributions-and-simulation-basics/exponential-gamma-and-weibull-waiting-time-models/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson068() {
  const t=2, scale=2, shape=2;
  const result={exponentialSurvival:Math.exp(-t/scale),
    weibullSurvival:Math.exp(-((t/scale)**shape)),
    gammaMean:shape*scale,gammaVariance:shape*scale*scale};
  return result;
}

export const checkedResult = {"exponentialSurvival":0.36787944117144233,"weibullSurvival":0.36787944117144233,"gammaMean":4,"gammaVariance":8};

// Run this file directly: npx tsx lessons/07-probability-distributions-and-simulation-basics/068-exponential-gamma-and-weibull-waiting-time-models.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson068(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "exponentialSurvival": 0.36787944117144233,
  "weibullSurvival": 0.36787944117144233,
  "gammaMean": 4,
  "gammaVariance": 8
}

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

Lesson notes

The rule

Exponential S(t)=exp(−t/scale); Weibull S(t)=exp(−(t/scale)^shape)