commit e3b0b0b1a9e3c7f62bfbec57f24a603275cfcaa7
parent 01225b5275cdae0215412fc0704c88bfc2128dd6
Author: Jared Tobin <jared@jtobin.io>
Date: Thu, 4 Jun 2026 15:22:29 -0230
add module-level examples to Bounded and Paired
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/lib/Numeric/Eproc/Bounded.hs b/lib/Numeric/Eproc/Bounded.hs
@@ -26,6 +26,16 @@
-- nonnegative supermartingale, so by Ville's inequality the
-- probability of ever crossing the threshold is at most @alpha@,
-- regardless of when the user decides to stop streaming samples.
+--
+-- == Example
+--
+-- Test @H_0: E[x] = 0.5@ for @x@ in @[0, 1]@ at level @alpha = 1e-3@
+-- against a stream with empirical mean @0.8@:
+--
+-- >>> let cfg = config 0.5 0.0 1.0 1.0e-3 Newton
+-- >>> let xs = concat (replicate 30 [1, 1, 0, 1, 1, 0, 1, 1, 1, 1])
+-- >>> decide cfg (foldl' (update cfg) (initial cfg) xs)
+-- Reject
module Numeric.Eproc.Bounded (
-- * Test configuration and state
diff --git a/lib/Numeric/Eproc/Paired.hs b/lib/Numeric/Eproc/Paired.hs
@@ -23,6 +23,17 @@
-- alignment would need to bet against a richer alternative (the
-- joint distribution rather than the marginal difference) and is
-- beyond the scope of this module.
+--
+-- == Example
+--
+-- Test @H_0: E[a] = E[b]@ for samples in @[0, 1]@ at level
+-- @alpha = 1e-3@ against a stream of paired observations where @a@
+-- runs systematically higher than @b@:
+--
+-- >>> let cfg = config 0.0 1.0 1.0e-3 Newton
+-- >>> let ps = take 1000 (cycle [(1, 0), (1, 0), (0, 0), (1, 1)])
+-- >>> decide cfg (foldl' (update cfg) (initial cfg) ps)
+-- Reject
module Numeric.Eproc.Paired (
-- * Test configuration and state