Description Usage Arguments Details Value References See Also Examples
firstdigitsfreq
returns a vector containing the numdigits
first
significant digits frequencies of data x
.
1 | firstdigitsfreq(x, numdigits = 1)
|
x |
Numeric matrix or vector. |
numdigits |
A positive integer, default is 1. |
This function takes the user's data x
as an argument, and outputs the
numdigits
first digits frequencies of the data. For example, inputting
x
={1,2,30,400} and numdigits
=1 will return the vector
{1,1,1,1,0,0,0,0,0}.
Note that running firstdigitsfreq{x, numdigits}
is equivalent to running:
freqdigits(extractdigits(x, numdigits), numdigits)
Thus zeroes are excluded. For more details on this process,
see extractdigits
and freqdigits
.
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 | firstdigitsfreq(1:9, 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.