Trials

object Trials(source)

Properties

Link copied to clipboard
const val MAX_PER_ARM: Int = 30

Functions

Link copied to clipboard
fun minPerArm(alpha: Long, max: Int = MAX_PER_ARM): Int?

Fewest trials per arm at which all-fail against all-pass reaches alpha.

Link copied to clipboard
fun plan(rate: Long, alpha: Long, targetPower: Long, max: Int = MAX_PER_ARM): TrialPlan

The smallest trials per arm, from the observed failure rate, whose chance of reaching alpha against a control that never fails is at least targetPower.

Link copied to clipboard
fun power(n: Int, k: Int, rate: Long): Long

P(Bin(n, rate) >= k) in micro-units, by a dynamic program in picos with each product floored, so the value is at most 1 micro-unit low.

Link copied to clipboard
fun rate(failures: Int, runs: Int): Long

Laplace's rule, (failures + 1) / (runs + 2) in micro-units: never exactly 0 or 1.

Link copied to clipboard
fun threshold(n: Int, alpha: Long): Int?

Fewest treatment failures out of n, with a clean control of n, that reach alpha.