liveBook · Manning

Continuous distribution

As explained in Fabulous Adventures in Data Structures and Algorithms

A continuous distribution assigns probabilities over values in a continuous range.

A continuous distribution models a random real number whose possible values occupy a continuous range rather than an enumerable set. A manufacturing process might produce part diameters with small, random variation; each sample is one real-valued measurement. section 15.1

A probability density function (PDF) assigns a non-negative weight to each real value. Probability over an interval comes from the area under the PDF there, divided by the total area. A PDF with total area 1 is normalized; many useful PDFs are not. section 15.1 section 15.6

Several operations connect the density to sampling:

  • Integrate the PDF to obtain the cumulative distribution function (CDF), which gives the probability that a sample is less than a chosen value. section 15.6
  • Invert the CDF to obtain the quantile function; applying it to a standard uniform sample produces a sample from the target distribution. section 15.6
  • Use rejection sampling when the PDF is known but its quantile function is unavailable; a helper distribution supplies candidate points, though finding one can be difficult and many candidates may be rejected. section 15.6

Uniform samples and a visible sanity check

The continuous uniform distribution makes every value between a minimum and maximum equally likely. In C#, a standard instance can generate values with `Random.NextDouble()`. Drawing 100,000 samples and placing them into 40 histogram columns should produce columns with roughly equal heights, while random variation prevents a perfectly flat result. section 15.2

double P(double x) => 
    0.0 <= x && x <= 1.0 ?
        Math.Pow(x, 0.5) * Math.Pow(1.0 - x, 1.5) :
        0.0;

Inspect a concrete beta-distribution PDF: it is nonzero only from 0 to 1 and assigns varying density across that interval. section 15.1

How Fabulous Adventures in Data Structures and Algorithms covers it

How deep it goes
Defines PDFs, normalization, CDFs, quantiles, and sampling methods, while deferring arbitrary posterior sampling to Markov-based methods.
Examples
Uses beta densities, manufacturing measurements, uniform samples, C# distribution objects, and vertical histograms.
What it assumes
Builds from random sampling and probability concepts, while treating continuous supports and PDFs as the necessary new machinery.
What you can do after
Evaluate and understand real-valued probabilities, then apply inverse-transform or rejection sampling when the necessary distribution information is available.
How it connects
Connects probability density functions, cumulative distribution functions, quantile functions, uniform distributions, normal distributions, and rejection sampling.

Also explained in

Compare how 2 books explain continuous distribution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fabulous Adventures in Data Structures and Algorithms. The section links point to the parts of the book it draws on.