expect_mc_test {mcunit} | R Documentation |
Test if p-values are coming from the null using a sequential approach.
Description
Requires as input a generic test that for a given sample size provides a vector of p-values. Aims to reject if these are not from the null. Guarantees a bound on the type I error rate.
Usage
expect_mc_test(object, control = NULL, npval = 1)
Arguments
object |
A function taking one argument n - that generates p-values based on a sample size n. |
control |
a list controlling the algorithm
|
npval |
number of p-values returned by the test. A Bonferroni correction is applied if >1. Default: 1. |
Value
The first argument, invisibly, to allow chaining of expectations.
Examples
pvalsampler <- function(n){
x <- sample.int(11,size=n,replace=TRUE)-1;
chisq.test(tabulate(x+1,nbins=11),
p=rep(1/11,11))$p.value
}
expect_mc_test(pvalsampler)