From 906ae5ad3a960e4c7d7c32528ced79ba63ee2238 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 27 Jan 2023 18:08:42 +1100 Subject: add beta' distribution --- src/PPL/Distr.hs | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3