README.md (1491B)
1 # mwc-probability 2 3 [![Build Status](https://secure.travis-ci.org/jtobin/mwc-probability.png)](http://travis-ci.org/jtobin/mwc-probability) 4 [![Hackage Version](https://img.shields.io/hackage/v/mwc-probability.svg)](http://hackage.haskell.org/package/mwc-probability) 5 [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jtobin/mwc-probability/blob/master/LICENSE) 6 7 Sampling function-based probability distributions. 8 9 A simple probability distribution type, where distributions are characterized 10 by sampling functions. 11 12 This implementation is a thin layer over `mwc-random`, which handles RNG 13 state-passing automatically by using a `PrimMonad` like `IO` or `ST s` under 14 the hood. 15 16 Examples 17 -------- 18 19 * Transform a distribution's support while leaving its density structure 20 invariant: 21 22 -- uniform over [0, 1] transformed to uniform over [1, 2] 23 succ <$> uniform 24 25 * Sequence distributions together using bind: 26 27 -- a beta-binomial composite distribution 28 beta 1 10 >>= binomial 10 29 30 * Use do-notation to build complex joint distributions from composable, 31 local conditionals: 32 33 hierarchicalModel = do 34 [c, d, e, f] <- replicateM 4 (uniformR (1, 10)) 35 a <- gamma c d 36 b <- gamma e f 37 p <- beta a b 38 n <- uniformR (5, 10) 39 binomial n p 40 41 Check out the haddock-generated docs on 42 [Hackage](https://hackage.haskell.org/package/mwc-probability) for other 43 examples. 44 45 ## Etc. 46 47 PRs and issues welcome. 48