fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Probability Distributions and Simulation Basics

10 algorithms in Financial Mathematics, Statistics, and Data Foundations · 10 with asserted arithmetic.

In this family#

  1. PMF, PDF, CDF, Survival, and Quantile Functions verified

    Reads an empirical sample from input.values and reports where the threshold input.x sits inside it, plus the sample quantile at probability input.p.

    pmfPdfCdfSurvivalAndQuantileFunctions(input)
  2. Bernoulli and Binomial Distributions verified

    Computes the Bernoulli mean and the binomial probability mass and cumulative probability for k successes in n independent trials with success probability p.

    bernoulliAndBinomialDistributions(input)
  3. Poisson Distribution and Event Counts verified

    Evaluates the Poisson probability of exactly k events, the cumulative probability of at most k, and the distribution's mean and variance, for a rate of lambda events per interval.

    poissonDistributionAndEventCounts(input)
  4. Uniform Distribution and Random Sampling verified

    Draws sampleCount values on the unit interval from a seeded linear congruential generator and reports the draws with their support and realised mean.

    uniformDistributionAndRandomSampling(input)
  5. Normal Distribution and Standard Normal verified

    Evaluates the normal density and cumulative probability at input.x for a distribution with mean mu and standard deviation sigma, and returns the standardised score that maps x onto the standard normal.

    normalDistributionAndStandardNormal(input)
  6. Lognormal Distribution and Positive Quantities verified

    Evaluates the lognormal density and cumulative probability at input.x for a variable whose logarithm is normal with mean mu and standard deviation sigma, and returns the distribution's median.

    lognormalDistributionAndPositiveQuantities(input)
  7. Student-t Distribution and Heavy Tails verified

    Evaluates the Student t density at input.x for df degrees of freedom and reports the distribution's variance, which only exists once df passes two.

    studentTDistributionAndHeavyTails(input)
  8. Exponential, Gamma, and Weibull Waiting-Time Models verified

    Evaluates three waiting-time models at the same point input.x: the exponential survival function, the gamma density, and the Weibull survival function, all sharing shape and scale.

    exponentialGammaAndWeibullWaitingTimeModels(input)
  9. Mixture Distributions, Multimodality, and Fat Tails verified

    Evaluates a weighted mixture of normal components at input.x, which is how a single series can show more than one mode and fatter tails than any of its parts.

    mixtureDistributionsMultimodalityAndFatTails(input)
  10. Random Sampling and Monte Carlo Intuition verified

    Estimates the probability p by counting how many of sampleCount seeded uniform draws land at or below it, and reports how far that Monte Carlo estimate lands from the known answer.

    randomSamplingAndMonteCarloIntuition(input)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { pmfPdfCdfSurvivalAndQuantileFunctions } from "fintech-algorithms/foundations/probability-distributions-and-simulation-basics/pmf-pdf-cdf-survival-and-quantile-functions";
import { bernoulliAndBinomialDistributions } from "fintech-algorithms/foundations/probability-distributions-and-simulation-basics/bernoulli-and-binomial-distributions";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Financial Mathematics, Statistics, and Data Foundations collects 120 algorithms across 12 families. For the concept behind this family rather than the call signatures, see the concept guides.