BeyondBenford (version 1.0)

digit.distr: Distribution of figures in a given position

Description

The function returns histograms of distribution of figures in a given position: (i) in the dataset, (ii) due to Benford, (iii) due to Blondeau Da Silva.

Usage

digit.distr(dat, mod = "ben", upbound = ceiling(max(dat)), dig = 1, 
col = c("#FFFFAA", "#AAFFAA"), colbl = c("#FFFFAA", "#AAFFFF"), 
colbebl = c("#FFFFAA", "#AAFFAA", "#AAFFFF"), main = "Distribution of digits",
legend = TRUE, leg = c("Observed", "Benford"), 
legbebl = c("Observed", "Benford", "Blondeau"), legbl = c("Observed", "Blondeau"))

Arguments

dat

The considered dataset, a data frame containing non-zero real numbers.

mod

If mod="ben", the data histogram and that of Benford are displayed, if mod="ben&blo", the data histogram, that of Benford and that of Blondeau Da Silva are plotted, and otherwise the data histogram and that of Blondeau Da Silva are given.

upbound

A positive integer, which characterizes the data. All (or most) of the data are lower than this "upper bound".

dig

The chosen position of the digit (from the left).

col

A vector containing two colors used to fill the bars of the histogram, if mod="ben".

colbl

A vector containing three colors used to fill the bars of the histogram, if mod="ben&blo".

colbebl

A vector containing two colors used to fill the bars of the histogram, if the latter case.

main

The title of the graph.

legend

If legend=TRUE, the legend is displayed.

leg

A two-components vector containing text appearing in the legend, if mod="ben".

legbebl

A three-components vector containing text appearing in the legend, if mod="ben&blo".

legbl

A two-components vector containing text appearing in the legend, if the latter case.

Value

Histograms of distribution of figures in a given position: (i) in the dataset, (ii) due to Benford, (iii) due to Blondeau Da Silva.

References

F. Benford (1938). The law of anomalous numbers. Proceedings of the American Philosophical Society, 78:127-131.

S. Blondeau Da Silva (2018). Benford or not Benford: a systematic but not always well-founded use of an elegant law in experimental fields. https://arxiv.org/abs/1804.06186.

S. Blondeau Da Silva (2018). Benford or not Benford: new results on digits beyond the first. https://arxiv.org/abs/1805.01291.

T. Hill (1995). The significant-digit phenomenon. The American Mathematical Monthly, 102(4):322-327. 10.2307/2974952.

R. Newcomb (1881). Note on the frequency of use of the different digits in natural numbers. American Journal of Mathematics, 4:39-40. 10.2307/2369148.

Examples

Run this code
# NOT RUN {
data(address_AixesurVienne)
digit.distr(address_AixesurVienne,mod="ben&blo",upbound=75)

data(address_PierreBuffiere)
digit.distr(address_PierreBuffiere,mod="blo",dig=2)

# }

Run the code above in your browser using DataLab