expect_bernoulli {mcunit}R Documentation

Test Bernoulli distribution using buckets

Description

Test if the success probability of a Bernoulli experiment lies within a desired 'bucket'. This used the sequential procedure described in Gandy et al. (2019).

Usage

expect_bernoulli(object, J, ok, epsilon = 0.001, ...)

Arguments

object

Function that performs one sampling step. Returns 0 or 1.

J

Buckets to use. A matrix with two rows, each column describes an interval bucket. Column names give names for the bucket(s).

ok

Name of bucket(s) that pass the Unit test.

epsilon

Error bound.

...

Further parameters to be passed on to 'mctest'.

Value

The first argument, invisibly, to allow chaining of expectations.

References

Gandy A, Hahn G, Ding D (2019). “Implementing Monte Carlo Tests with P-value Buckets.” Scandinavian Journal of Statistics. doi: 10.1111/sjos.12434, Accepted for publication, 1703.09305, https://arxiv.org/abs/1703.09305.

Examples

   J <- matrix(nrow=2,c(0,0.945, 0.94,0.96, 0.955,1))
   colnames(J) <- c("low","ok","high")
   gen <- function() as.numeric(runif(1)<0.95)
   expect_bernoulli(gen,J=J,ok="ok")

[Package mcunit version 0.3.2 Index]