Description Usage Arguments Details Value References See Also Examples
freqdigits
computes the frequencies of numbers with numdigits
first significant digits in a vector x
of first digits.
1 | freqdigits(x, numdigits = 1)
|
x |
A significant digits vector. |
numdigits |
A positive integer, default is 1. |
freqdigits
may return different vectors for a single x
depending upon the numdigits
chosen. For example,
freqdigits(1:9, 1)
will return a vector of ones of length 9, but
freqdigits(1:9, 2)
will return a vector of zeroes of length 90
because the values in 1:9 all have only 1 digit.
If the vector x
contains first digits of varying lengths, then freqdigits
will only count the first digits containing
numdigits
digits. For example, inputting x
={1,10,100} with
numdigits
=1 will return a vector of length 9 with a 1 in the first
position and zeroes otherwise.
The output will always be a vector of length 9*(10^(numdigits-1)).
Lesperance M, Reed WJ, Stephens MA, Tsao C, Wilton B (2016) Assessing conformance with Benford's Law: goodness-of-fit tests and simultaneous confidence intervals. PLoS one; 11(3).
1 2 3 | freqdigits(1:9, 1)
freqdigits(c(456,290,180), 3)
freqdigits(extractdigits(c(0.41, 1.25, 0.21, 0.54, 0.19),1),1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.