Description Usage Arguments Details Value Note Author(s) References Examples

Performs the mean distance goodness-of-fit test and the energy goodness-of-fit test of Poisson distribution with unknown parameter.

1 2 3 4 5 | ```
poisson.e(x)
poisson.m(x)
poisson.etest(x, R)
poisson.mtest(x, R)
poisson.tests(x, R, test="all")
``` |

`x` |
vector of nonnegative integers, the sample data |

`R` |
number of bootstrap replicates |

`test` |
name of test(s) |

Two distance-based tests of Poissonity are applied in `poisson.tests`

, "M" and "E". The default is to
do all tests and return results in a data frame.
Valid choices for `test`

are "M", "E", or "all" with
default "all".

If "all" tests, all tests are performed by a single parametric bootstrap computing all test statistics on each sample.

The "M" choice is two tests, one based on a Cramer-von Mises distance and the other an Anderson-Darling distance. The "E" choice is the energy goodness-of-fit test.

`R`

must be a positive integer for a test. If `R`

is missing or 0, a warning is printed but test statistics are computed (without testing).

The mean distance test of Poissonity (M-test) is based on the result that the sequence
of expected values E|X-j|, j=0,1,2,... characterizes the distribution of
the random variable X. As an application of this characterization one can
get an estimator *\hat F(j)* of the CDF. The test statistic
(see `poisson.m`

) is a Cramer-von Mises type of distance, with
M-estimates replacing the usual EDF estimates of the CDF:

*M_n = n sum [j>=0] (\hat F(j) - F(j; \hat λ))^2
f(j; \hat λ).*

In `poisson.tests`

, an Anderson-Darling type of weight is also applied when `test="M"`

or `test="all"`

.

The tests are implemented by parametric bootstrap with
`R`

replicates.

An energy goodness-of-fit test (E) is based on the test statistic

*Q_n = n((2/n) sum[1:n] E|x_i-X| - E|X-X'| - (1/n^2) sum[1:n,1:n]
|x_i-x_j|),*

where X and X' are iid with the hypothesized null distribution. For a test of H: X ~ Poisson(*λ*), we can express E|X-X'| in terms of Bessel functions, and E|x_i - X| in terms of the CDF of Poisson(*λ*).

If test=="all" or not specified, all tests are run with a single parametric bootstrap. `poisson.mtest`

implements only the Poisson M-test with Cramer-von Mises type distance. `poisson.etest`

implements only the Poisson energy test.

The functions `poisson.m`

and `poisson.e`

return the test statistics. The function
`poisson.mtest`

or `poisson.etest`

return an `htest`

object containing

`method` |
Description of test |

`statistic` |
observed value of the test statistic |

`p.value` |
approximate p-value of the test |

`data.name` |
replicates R |

`estimate` |
sample mean |

`poisson.tests`

returns "M-CvM test", "M-AD test" and "Energy test" results in a data frame with columns

`estimate` |
sample mean |

`statistic` |
observed value of the test statistic |

`p.value` |
approximate p-value of the test |

`method` |
Description of test |

which can be coerced to a `tibble`

.

The running time of the M test is much faster than the E-test.

Maria L. Rizzo mrizzo @ bgsu.edu and Gabor J. Szekely

Szekely, G. J. and Rizzo, M. L. (2004) Mean Distance Test of Poisson Distribution, *Statistics and Probability Letters*,
67/3, 241-247. doi: 10.1016/j.spl.2004.01.005.

Szekely, G. J. and Rizzo, M. L. (2005) A New Test for
Multivariate Normality, *Journal of Multivariate Analysis*,
93/1, 58-80,
doi: 10.1016/j.jmva.2003.12.002.

1 2 3 4 5 6 7 8 | ```
x <- rpois(50, 2)
poisson.m(x)
poisson.e(x)
poisson.etest(x, R=199)
poisson.mtest(x, R=199)
poisson.tests(x, R=199)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.