chi2 {BeyondBenford} R Documentation

## Pearson's chi-squared test

### Description

It is a test of goodness of fit to find out whether the distribution of first (second, third or fourth) digit in the studied data differs from two theoretical distributions (that of Benford and that of Blondeau Da Silva) or not. The null hypothesis states that the studied distribution is consistent with the considered theoretical distribution.

### Usage

chi2(dat, mod = "ben", lwbound = max(floor(min(abs(dat))) + 1, (10^(dig - 1))),
upbound = ceiling(max(dat)), dig = 1, pval = 0)


### Arguments

 dat The considered dataset, a data frame containing non-zero real numbers. mod A character string. If mod="ben", the theorical distribution considered is that of Benford, else it is Blondeau Da Silva's ones which is chosen. lwbound A positive integer, which characterizes the data. All (or most) of the data are greater than this "lower bound". upbound A positive integer, which characterizes the data. All (or most) of the data are lower than this "upper bound". dig The chosen position of the digit (from the left). pval If pval=0, the p-value is not returned, else it is available.

### Value

A data frame containing the Pearson chi-squared statistic (and the associated p-value if requested).

### Note

This warning message can appear: NAs introduced during the automatic conversion. This is due to the fact that some data are not numerical in the entered dataset. Non numerical values and zeros are not counted.

### Author(s)

Blondeau Da Silva St\'ephane

### References

K. Pearson (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, 50(302):157-175.

### Examples

data(address_PierreBuffiere)