Skip to contents

Create a ddf object describing Benford's law for the given base.

Usage

benford(b)

Arguments

b

An integer, the base of the number system. Has to be at least 2.

Value

A ddf distribution as described above.

Details

Benford's law describes the phenomenon that in many real-life numerical data sets, leading digits tend to be small.

For this, given an arbitrary base \(b\), one can consider the distribution with support \(\{1, \dots, b-1\}\) on which the probability mass function $$p(k) = \log_b \left( 1 + \frac{1}{k} \right)$$ is defined, where the subscript \(b\) denotes the base of the logarithm.

For more information, we refer to the below linked Wikipedia article.

See also

Examples

# Expected distribution of first digits,according
# to Benford's law, in the decimal system
benford(10)
#> Benford's law in base 10 
#> 
#> Support:
#> [1] 1 2 3 4 5 6 7 8 9
#> 
#> Probabilities:
#> [1] 0.30103000 0.17609126 0.12493874 0.09691001 0.07918125 0.06694679 0.05799195
#> [8] 0.05115252 0.04575749