Description Usage Arguments Details Value References See Also Examples
CVMStats
computes p-values for the CVM statistics for testing
H_0: probabilities follow Benford vs. the most general alternative,
H_1: probabilities are multinomial. The four statistics are W^2
(Cramer-von Mises), U^2 (Watson), A^2 (Anderson-Darling) and
X^2 (Pearson's chi-square).
1 2 |
freq |
Vector of multinomial probabilities. |
method |
Parameter to specify the statistic and the method by which to compute the statistic. This parameter can take on any of the following values, or a vector containing any combination of these values separated using commas:
These parameter values correspond to the statistics and their methods respectively:
Specifying no method will return all statistics and methods. |
digits |
A significant digits vector. If unspecified, default is 1:9. |
There are three CVM type statistics: Cramer-von Mises as
W
, Watson as U
, Anderson-Darling as A
, as
well as Pearson's chi-square as X
.
The three CVM type statistics can be computed using one of two
methods: Imhof's numerical method, or a chi-square approximation. The
argument method
can be used to indicate which statistics to compute
with which method. Note that the chi-square approximation is faster to
compute than the Imhof numerical method. See Lesperance et. al (2016) for further
details.
The output is a vector containing the user specified statistics by method.
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). Wong, S. (2010) Testing Benford's Law with the first two significant digits. University of Victoria, Master's thesis.
1 2 | set.seed(123)
CVMStats((firstdigitsfreq(rnorm(100), 1)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.