aboutsummaryrefslogtreecommitdiff
path: root/src/PPL/Distr.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/PPL/Distr.hs')
-rw-r--r--src/PPL/Distr.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/PPL/Distr.hs b/src/PPL/Distr.hs
index 797379b..093e102 100644
--- a/src/PPL/Distr.hs
+++ b/src/PPL/Distr.hs
@@ -69,6 +69,10 @@ beta a b = do
y <- gamma b
pure $ x / (x + y)
+beta' a b = do
+ p <- beta a b
+ pure $ p / (1-p)
+
bern p = (< p) <$> uniform
binom n = fmap (length . filter id . take n) . iid . bern