expect_bernoulli: Test Bernoulli distribution using buckets

Description Usage Arguments Value References Examples

View source: R/expect_simctest.R

Description

Test if the success probability of a Bernoulli experiment lies within a desired 'bucket'. This used the sequential procedure described in \insertCiteGandyHahnDing:pvaluebuckets;textualmcunit.

Usage

1
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

\insertAllCited

Examples

1
2
3
4
   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")

mcunit documentation built on April 2, 2021, 5:06 p.m.