rbt: Randomized Binomial Test

View source: R/rbt.R

rbtR Documentation

Randomized Binomial Test

Description

In short, an RBT rejects borderline cases with \gamma probability. Whereas tests on binomial data as performed with Clopper-Pearson intervals or Wilson Score intervals usually have test size < nominal significance \alpha level, an RBT will be guaranteed to always have theoretical size == \alpha.

Usage

rbt(x, n, p_h0, alpha = 0.05, requirement_type = "gt")

Arguments

x

observed count

n

total count

p_h0

probability under the null hypothesis

alpha

defaults to .05

requirement_type

form of alternative hypothesis, defaults to "gt"

Details

Further detail can be found on: http://nicksun.fun/statistics/2020/11/16/sawtooth-power-curves.html

The purpose of the rbt() function is to provide a comparison against Wilson and Clopper-Pearson based testing.

Value

list containing rejection bound, rejection region, gamma probability, and outcome of RBT

Examples

output <- vector(length=100, mode="numeric")
for (i in 1:100) {
  output[i] <- rbt(x=7, n=100, alpha=.05, requirement_type="gt")
}
mean(output) # should be about .526

njjms/nicks documentation built on May 4, 2022, 8:10 a.m.