Tests if a set of data points is uniformly distributed over a specified interval [a,b].

1 2 |

`x` |
A numeric vector of data values. |

`bins` |
If specified, the number of bins to use to discretise the interval. Otherwise, the number of bins will be chosen automatically. |

`interval` |
A two-element vector giving the support of the uniform distribution. The
default is |

`min.bin.size` |
The minimum number of data points to have in each bin. If bins cannot be chosen without violating this constraint, an error is generated. The default is 10. This parameter is ignored if bins is specified. |

`all.inside` |
Determines if data points outside the interval should be counted as belonging to the extremal bins. The default is TRUE. |

`rightmost.closed` |
Determines if data points that coinside
with |

`...` |
Additional parameters to be passed to |

This function tests the fit of a set of data points to a uniform distribution on
*[a,b]* by partitioning *[a,b]* into bins bins, counting how many
points fall in each bin and then testing that the points are equally distributed
among the bins using Pearson's chi-squared test.

When bins is not specified, its value is selected using the following
heuristic. Let *n* be the number of data points. If *n>200*, then
bins is set to 20. Otherwise, bins is set to *n/10*.
Next,while there is a bin containing fewer than min.bin.size points in
the resulting partition, bins is decremented by one. This process stops
either when bins is equal to 1 or every bin contains at least
min.bin.size points.

A list with class “htest” containing the following components:

`statistic` |
the value of the test statistic. |

`parameter` |
A vector containing the degrees of freedom of the chi-squared test (df), the left end of the interval (a) and the right end of the interval (b). |

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

`method` |
a character string indicating what type of test was performed. |

`data.name` |
a character string giving the name of the data. |

`bins` |
The number of bins used for the test. |

`min.bin.size` |
The minimum bin size. |

`interval` |
The interval used for the test. |

The arguments all.inside and rightmost.closed are included for experimentation and should be altered with caution.

Andrew Hart and Servet Mart<ed>nez

`chisq.test`

, `findInterval`

, `ks.unif.test`

1 2 3 | ```
#Generate an IID uniform(0,1) sequence
u <- runif(1000)
chisq.unif.test(u)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.