The transformed population, on a log scale
Both horizontal axes are log10(value). The density includes the Jacobian ln(10) × value; the CDF does not need a density correction.
Try this
- Rewind and step through the first draws. Start at probability U on the vertical axis, move right to the CDF, then down to log10 of the sampled value.
- Choose the log-uniform preset: α = 1 gives a straight CDF and a flat density on the log10 scale, not a uniform density in mass.
- Increase the number of draws. The histogram becomes smoother; the analytic target and the cached uniform sequence do not change.
A normalized bounded power law, including α = 1
The stellar-mass illustration uses p(x) = x−α/C on [L,H] = [0.1,20], zero outside. For k = 1 − α, C = (Hk − Lk)/k and the inverse CDF is [Lk + U(Hk − Lk)]1/k. At α = 1 the exact logarithmic limit is C = ln(H/L), F(x) = ln(x/L)/ln(H/L), and F−1(U) = L(H/L)U.
The browser evaluates the nonzero-k formula using expm1/log1p to avoid cancellation near α = 1; endpoints map exactly to L and H. This is a proper normalized population, not an unnormalised power-law sketch. The other targets are Exponential(rate 1) and Log-normal(log-mean 0, log-SD 0.7).
Changing coordinates changes a density
For z = log10(x), the CDF is F(10z), while the density is pz(z) = ln(10)10zpx(10z). A density per mass unit cannot be plotted unchanged as a density per logarithmic unit.
Finite samples and finite windows
The discrepancy is the two-sided one-sample Kolmogorov–Smirnov statistic: max over ordered probabilities U(i) of i/N − U(i) and U(i) − (i−1)/N. It is not a p-value or a model-selection probability. At zero draws there is no empirical discrepancy; only the analytic target is drawn.
For unbounded targets the view spans at least the 0.00001 to 0.99999 target quantiles and all selected draws. For a bounded power law it includes the exact support. The target-mass metric reports omitted probability honestly; neither target nor histogram is renormalised to the viewport. Histogram heights divide by all revealed draws.
A 1,500-value uniform sequence is cached for each seed. Changing family, exponent or sample count reuses it; playback reveals prefixes in 100 percentage steps, initially paused at the result. The shared browser RNG differs from R's RNG, so matching seed numbers give different individual draws, not different target laws.