rbenf {BenfordTests}R Documentation

Random Sample Satisfying Benford's Law

Description

Returns a random sample with length n satisfying Benford's law.

Usage

rbenf(n)

Arguments

n

Number of observations.

Details

This distribution has the density:

f\left(x\right)=\frac{1}{x\cdot ln\left(10\right)} \forall x\in[1,10]

Value

Returns a random sample with length n satisfying Benford's law.

Author(s)

Dieter William Joenssen Dieter.Joenssen@googlemail.com

References

Benford, F. (1938) The Law of Anomalous Numbers. Proceedings of the American Philosophical Society. 78, 551–572.

See Also

qbenf; pbenf

Examples

#Set the random seed to an arbitrary number
set.seed(421)
#Create a sample satisfying Benford's law
X<-rbenf(n=20)
#Look at sample
X
#should be
# [1] 6.159420 1.396476 5.193371 2.064033 7.001284 5.006184
#7.950332 4.822725 3.386809 1.619609 2.080063 2.242473 1.944697 5.460581
#[15] 6.443031 2.662821 2.079283 3.703353 1.364175 3.354136

[Package BenfordTests version 1.2.0 Index]