CVMStats: Compute Cramer-von Mises Statistics

Description Usage Arguments Details Value References See Also Examples

Description

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).

Usage

1
2
CVMStats(freq, method = c("W", "Wap", "U", "Uap", "A", "Aap", "X"),
  digits = 1:9)

Arguments

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:

  1. 'W'

  2. 'Wap'

  3. 'U'

  4. 'Uap'

  5. 'A'

  6. 'Aap'

  7. 'X'

These parameter values correspond to the statistics and their methods respectively:

  1. Cramer-von Mises, Imhof

  2. Cramer-von Mises, approximation

  3. Watson, Imhof

  4. Watson, approximation

  5. Anderson-Darling, Imhof

  6. Anderson-Darling, approximation

  7. Pearson

Specifying no method will return all statistics and methods.

digits

A significant digits vector. If unspecified, default is 1:9. digits must match the frequencies frequencies.

Details

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.

Value

The output is a vector containing the user specified statistics by method.

References

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.

See Also

CVMEigen

Examples

1
2

mlespera/BenGood documentation built on May 18, 2019, 3:43 p.m.