Safe Haskell | Safe-Inferred |
---|
This library provides tools for doing single parameter Bayesian inference.
Example ghci use:
# Generate a discrete simulation of the uniform prior for the bias # of a single coin on [0,1] using a grid of 100 points. let prior = uniformPrior 100 # Update the prior as if we flipped the coin 100 times and got 25 heads. let posterior = coins prior 25 75 # Optionally, import Graphics.Gnuplot.Simple and convert posterior # to a list of tuples for plotting using listify :m + Graphics.Gnuplot.Simple plotList [] (listify posterior) # As you'd expect, nearly all of the probability mass is concentrated # between a bias of 0.2 and 0.3
Documentation
uniformPDF :: Ord k => [k] -> Distro kSource
Takes a list of elements and generates a uniform Distro over them.
uniformPrior :: Integer -> Distro ProbSource
Generates a simulated uniform distro over [0,1] with user supplied granularity.
singleCoin :: Distro Prob -> Result -> Distro ProbSource
Updates a distro with a new trial that either succeeded or failed.