The function td_tests() is a wrapper which applies the functionstd_independence() and
td_uniformity to a data frame. When a group is specified, tests are conducted separated
for each group. P-values and p-values adjusted by the false discovery rate (Benjamini
and Hochberg, 1995) are reported.
td_tests(
data,
variable,
decimals,
group = NULL,
reps = 10000,
test = "Chisq",
tolerance = 64 * .Machine$double.eps
)A data frame
A numeric variable. Tests for terminal digits are performed on this variable.
an integer specifying the number of decimals. This can be zero if the terminal digit is not a decimal.
A variable used to group the primary variable such that p-values are calculated separately for each group. The default is set to NULL in which case p-values are simply calculated for the whole data set.
an integer specifying the number of Monte Carlo simulations. The default is set to 10,000.
a string specifying the test of independence. The default is Pearson's chi-squared statistic ("Chisq"). Also available is the log-likelihood ratio statistic ("G2"), the Freeman-Tukey statistic ("FT"), and the Root-mean-square statistic ("RMS").
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 chisq.test function from the stats
package in R.
A data frame containing the following components:
the value of the test statistic
the simulated p-value for the test of independence
the simulated p-value for the test of uniformity (chi-squared GOF)
the simulated p-value for the test of independence adjusted via the
false discovery rate (if the group variable is specified)
the simulated p-value for the test of uniformity (chi-squared GOF)
adjusted via the false discovery rate (if the group variable is specified)
Benjamini, Y., and Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society Series B, 57, 289<U+2013>300. doi: 10.1111/j.2517-6161.1995.tb02031.x. https://www.jstor.org/stable/2346101.
# NOT RUN {
td_tests(decoy, weight, decimals = 2, group = subject, reps = 1000)
# }
Run the code above in your browser using DataLab