BenfordDistribution
✖
BenfordDistribution
Details

- BenfordDistribution is also known as the first-digit distribution.
- The probability for integer value
in a Benford distribution is proportional to
for
, and is
otherwise.
- BenfordDistribution allows
to be any integer such that
.
- BenfordDistribution can be used with such functions as Mean, CDF, and RandomVariate.
Background & Context
- BenfordDistribution[b] represents a discrete statistical distribution defined at integer values
, where the parameter b is an integer known as the base parameter satisfying
. The Benford distribution is sometimes referred to as the first-digit distribution. It has a discrete probability density function (PDF) with monotonically decreasing values.
- The Benford distribution is associated with American physicist Frank Benford, whose eponymous "Benford's law" (sometimes also referred to as the Newcomb–Benford law in honor of Canadian-American mathematician Simon Newcomb, who published the result some 50 years before Benford) serves as the cornerstone for the distribution. Benford's law states that for base
, the probability that the first digit of numbers in many classes of real-world datasets is 1 is not given by 1/9 ≈ 11.1% (as would be naively expected) but is actually closer to 30%. Furthermore, the overall probability that a digit
occurs as an initial digit is approximately equal to
. (The result generalizes to other bases
using the change of base formula for logarithms.) Benford's law has been observed to occur empirically across a large number of unrelated datasets, including catalogs of physical and mathematical constants, stock prices, population counts, and death rates. In general, Benford's distribution best approximates distributions of values spanning multiple orders of magnitude. It has also been extended to look at the frequency of second and later digits and at leading sequences of
digits for
.
- RandomVariate can be used to give one or more machine- or arbitrary-precision (the latter via the WorkingPrecision option) pseudorandom variates from a Benford distribution. Distributed[x,BenfordDistribution[b]], written more concisely as xBenfordDistribution[b], can be used to assert that a random variable x is distributed according to a Benford distribution. Such an assertion can then be used in functions such as Probability, NProbability, Expectation, and NExpectation.
- The probability density and cumulative distribution functions may be given using PDF[BenfordDistribution[b],x] and CDF[BenfordDistribution[b],x]. The mean, median, variance, raw moments, and central moments may be computed using Mean, Median, Variance, Moment, and CentralMoment, respectively. These quantities can be visualized using DiscretePlot.
- DistributionFitTest can be used to test if a given dataset is consistent with a Benford distribution, EstimatedDistribution to estimate a Benford parametric distribution from given data, and FindDistributionParameters to fit data to a Benford distribution. ProbabilityPlot can be used to generate a plot of the CDF of given data against the CDF of a symbolic Benford distribution, and QuantilePlot to generate a plot of the quantiles of given data against the quantiles of a symbolic Benford distribution.
- TransformedDistribution can be used to represent a transformed Benford distribution, CensoredDistribution to represent the distribution of values censored between upper and lower values, and TruncatedDistribution to represent the distribution of values truncated between upper and lower values. CopulaDistribution can be used to build higher-dimensional distributions that contain a Benford distribution, and ProductDistribution can be used to compute a joint distribution with independent component distributions involving Benford distributions.
- BenfordDistribution is related to a number of other probability distributions, including ZipfDistribution and ParetoDistribution. Other distributions are related to BenfordDistribution through Benford's law. For example, empirical testing of random numbers distributed according to ExponentialDistribution, WeibullDistribution, GammaDistribution, LogLogisticDistribution, and ExponentialPowerDistribution shows adherence to Benford's law, whereas random numbers generated according to UniformDistribution, HalfNormalDistribution, NormalDistribution, and GumbelDistribution do not. Several other distributions have relationships with Benford's law depending on their input parameters. For example, random numbers generated according to ChiSquareDistribution[1] satisfy Benford's law, though the adherence decreases for ChiSquareDistribution[ν] as ν increases. Similarly, samples of FRatioDistribution[n,m] random variates obey Benford's law for small values of n and m, with decreasing adherence as n and m increase, and random variates distributed according to LogNormalDistribution[μ,σ] have increased agreement with Benford's law for large values of μ and ν (with perturbations of ν having a greater effect than perturbations of μ).
Examples
open allclose allBasic Examples (5)Summary of the most common use cases

https://wolfram.com/xid/0pnmcnrnc2a4g47e-n7mf5g


https://wolfram.com/xid/0pnmcnrnc2a4g47e-45ni0y

Cumulative distribution function:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-9v8sg


https://wolfram.com/xid/0pnmcnrnc2a4g47e-1uo91w


https://wolfram.com/xid/0pnmcnrnc2a4g47e-dh1yaj


https://wolfram.com/xid/0pnmcnrnc2a4g47e-kymr3a


https://wolfram.com/xid/0pnmcnrnc2a4g47e-ty0rdk


https://wolfram.com/xid/0pnmcnrnc2a4g47e-s0mztv


https://wolfram.com/xid/0pnmcnrnc2a4g47e-qposr9

Scope (6)Survey of the scope of standard use cases
Generate a sample of pseudorandom numbers from a Benford distribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-qhtk5j
Compare its histogram to the PDF:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-03mwaz

Distribution parameters estimation:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-45b7g2
Estimate the distribution parameters from sample data:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-epi747

Compare the density histogram of the sample with the PDF of the estimated distribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-f8ui5o


https://wolfram.com/xid/0pnmcnrnc2a4g47e-o0qn2b


https://wolfram.com/xid/0pnmcnrnc2a4g47e-gpy7ac


https://wolfram.com/xid/0pnmcnrnc2a4g47e-budvud


https://wolfram.com/xid/0pnmcnrnc2a4g47e-wuj61d


https://wolfram.com/xid/0pnmcnrnc2a4g47e-2nhz78


https://wolfram.com/xid/0pnmcnrnc2a4g47e-6hhi3


https://wolfram.com/xid/0pnmcnrnc2a4g47e-ibszs

https://wolfram.com/xid/0pnmcnrnc2a4g47e-2ytmih


https://wolfram.com/xid/0pnmcnrnc2a4g47e-7ctof9

Applications (3)Sample problems that can be solved with this function
Benford's distribution approximates distributions of values spanning multiple orders of magnitude. Consider a sample from a heavy-tailed distribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-mgq4bu
Find the order of magnitude between minimum and maximum:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-ga8g0h


https://wolfram.com/xid/0pnmcnrnc2a4g47e-crkqpx
Compare the histogram with the PDF of the corresponding BenfordDistribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-wgdluz

Now consider a sample from a light-tailed distribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-mhnw4h
Find the order of magnitude between minimum and maximum:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-gpr8mj

Compare the histogram with the PDF of the corresponding BenfordDistribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-1dxhne

Check whether the population of the largest cities in the United States follows Benford distribution:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-cxqdmd

https://wolfram.com/xid/0pnmcnrnc2a4g47e-hdbc6g

https://wolfram.com/xid/0pnmcnrnc2a4g47e-j952bg

The population of the 100 largest cities does not follow Benford distribution very well:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-7jqt3w

https://wolfram.com/xid/0pnmcnrnc2a4g47e-ccht9


https://wolfram.com/xid/0pnmcnrnc2a4g47e-myd3h8

https://wolfram.com/xid/0pnmcnrnc2a4g47e-m8zvks

https://wolfram.com/xid/0pnmcnrnc2a4g47e-hpixra

Find the first digits, not taking units into account:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-b4xcsv

https://wolfram.com/xid/0pnmcnrnc2a4g47e-rdzl1
The first digits are not uniformly distributed; it is more likely that their distribution follows Benford's law:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-dpudrq

Check if the hypothesis can be rejected:

https://wolfram.com/xid/0pnmcnrnc2a4g47e-i12if

Wolfram Research (2010), BenfordDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/BenfordDistribution.html.
Text
Wolfram Research (2010), BenfordDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/BenfordDistribution.html.
Wolfram Research (2010), BenfordDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/BenfordDistribution.html.
CMS
Wolfram Language. 2010. "BenfordDistribution." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BenfordDistribution.html.
Wolfram Language. 2010. "BenfordDistribution." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BenfordDistribution.html.
APA
Wolfram Language. (2010). BenfordDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BenfordDistribution.html
Wolfram Language. (2010). BenfordDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BenfordDistribution.html
BibTeX
@misc{reference.wolfram_2025_benforddistribution, author="Wolfram Research", title="{BenfordDistribution}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/BenfordDistribution.html}", note=[Accessed: 12-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_benforddistribution, organization={Wolfram Research}, title={BenfordDistribution}, year={2010}, url={https://reference.wolfram.com/language/ref/BenfordDistribution.html}, note=[Accessed: 12-May-2025
]}