Probability and Random Variables
10 algorithms in Financial Mathematics, Statistics, and Data Foundations · 10 with asserted arithmetic.
In this family#
-
Experiments, Outcomes, Sample Spaces, and Events verified
Sizes a sample space and a candidate event, and checks that every outcome named in the event actually appears in the sample space.
experimentsOutcomesSampleSpacesAndEvents(input) -
Probability Rules, Complements, Unions, and Intersections verified
Applies the complement and addition rules to a pair of events, deriving the probability that A does not happen and the probability that at least one of A or B happens.
probabilityRulesComplementsUnionsAndIntersections(input) -
Conditional Probability verified
Rescales the joint probability of two events by each marginal in turn, giving the probability of A once B is known and the probability of B once A is known.
conditionalProbability(input) -
Independence and Dependence verified
Compares the observed joint probability of two events against the product of their marginals, and reports both the verdict and the size of the gap.
independenceAndDependence(input) -
Bayes' Theorem and Base Rates verified
Turns a prior, a true-positive rate, and a false-positive rate into the posterior probability of the condition given a positive result, along with the unconditional probability of that result.
bayesTheoremAndBaseRates(input) -
Discrete and Continuous Random Variables verified
Validates a discrete random variable given as a support and a matching probability vector, echoing back the declared kind, the support, and the total mass it carries.
discreteAndContinuousRandomVariables(input) -
Expected Value verified
Weights each value of a discrete random variable by its probability and sums the result, keeping the individual products so the total can be read term by term.
expectedValue(input) -
Variance, Moments, and Moment-Generating Intuition verified
Computes the first two raw moments of a discrete random variable and derives its variance as the second raw moment less the square of the first.
varianceMomentsAndMomentGeneratingIntuition(input) -
Joint, Marginal, and Conditional Distributions verified
Collapses a joint probability table over each axis in turn to give the two marginal distributions, then renormalises one slice of it to give the conditional distribution of X at a chosen value of Y.
jointMarginalAndConditionalDistributions(input) -
Covariance and Correlation of Random Variables verified
Computes the probability-weighted covariance of the two variables in a joint distribution table and divides it by the product of their standard deviations to give the correlation.
covarianceAndCorrelationOfRandomVariables(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:
import { experimentsOutcomesSampleSpacesAndEvents } from "fintech-algorithms/foundations/probability-and-random-variables/experiments-outcomes-sample-spaces-and-events";
import { probabilityRulesComplementsUnionsAndIntersections } from "fintech-algorithms/foundations/probability-and-random-variables/probability-rules-complements-unions-and-intersections";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.