Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/Benford_tests.R
Applies the first digits function to each element of a given vector.
1 |
x |
A numeric vector. |
digits |
An integer determining the number of first digits to use for testing, i.e. 1 for only the first, 2 for the first two etc. |
The first digits function can be written as:
D_k(x) = \lfloor |x| \cdot 10^{≤ft( -1 \cdot \lfloor log_{10}|x| \rfloor + k -1 \right)}\rfloor
with k being the number of first digits that should be extracted.
x
is a numeric vector of arbitrary length.
Unlike other solutions, this function will work reliably with all real numbers.
Returns a vector of integers the same length as the input vector x
.
Dieter William Joenssen Dieter.Joenssen@googlemail.com
Joenssen, D.W. (2013) Two Digit Testing for Benford's Law. Proceedings of the ISI World Statistics Congress, 59th Session in Hong Kong. [available under http://www.statistics.gov.hk/wsc/CPS021-P2-S.pdf]
chisq.benftest
; ks.benftest
; usq.benftest
; mdist.benftest
; edist.benftest
; meandigit.benftest
; jpsq.benftest
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.