td_uniformity {terminaldigits} | R Documentation |
Test of uniformity of terminal digits
Description
The td_uniformity
function tests the uniformity of terminal digits via
Pearson's chi-squared test of goodness-of-fit. Rather than relying on the asymptotic
approximation to the chi-squared distribution, td_unformity
uses the chisq_gof
function from the discretefit
package to simulate the distribution under the null.
Usage
td_uniformity(x, decimals, reps = 10000, tolerance = 64 * .Machine$double.eps)
Arguments
x |
a numeric vector |
decimals |
an integer specifying the number of decimals. This can be zero if the terminal digit is not a decimal. |
reps |
a positive integer specifying the number of Monte Carlo simulations. The default is set to 10,000. |
tolerance |
sets an upper bound for rounding errors when evaluating
whether a statistic for a simulation is greater than or equal to the
statistic for the observed data. The default is identical to the tolerance
set for simulations in the |
Value
A list containing the following components:
statistic |
the value of the test statistic |
p_value |
the simulated p-value for the test |
method |
a character string describing the test |
data.name |
a character string give the name of the data |
Examples
td_uniformity(decoy$weight, decimals = 2, reps = 2000)