-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | "Uniform RNG => Non-Uniform RNGs" -- -- "Collection of transforms uniform random number generators (RNGs) into -- any of a dozen common RNGs. Each presenting several common interfaces. -- Additionally Empirical distributions can be sampled from and tested -- (chi-squared) against theoretical distributions." @package random-variates @version 0.1.1.0 module Stochastic.Tools maybeHead :: [a] -> Maybe a headOrElse :: a -> [a] -> a mapTuple :: (a -> b) -> (c -> d) -> (a, c) -> (b, d) histogram :: Double -> [Double] -> [Int] comb :: Int -> Int -> Double gamma :: Double -> Double lower_incomplete_gamma :: Double -> Double -> Double estimate_lower_gamma :: Double -> Double -> Double -> Double stirlingsApprox :: (Floating r, Ord r) => r -> r fac :: Int -> Integer factorial :: [Integer] fib :: Int -> Integer fibinacci :: [Integer] harmonics :: Double -> [Double] statefully :: (g -> (a, g)) -> Int -> g -> ([a], g) statefullyTakeWhile :: (g -> (a, g)) -> ([a] -> Bool) -> g -> ([a], g) type Histogram = [Datagram] data Datagram Datagram :: Double -> Double -> Int -> Double -> Double -> Double -> Datagram [lower_bound] :: Datagram -> Double [upper_bound] :: Datagram -> Double [frequency] :: Datagram -> Int [rel_frequence] :: Datagram -> Double [cum_frequence] :: Datagram -> Double [slope] :: Datagram -> Double fIHistogram :: [Double] -> Histogram maxf :: Ord b => [b] -> b minf :: Ord b => [b] -> b datagramFromRaw :: Int -> Double -> [(Double, Int)] -> [Datagram] accMap :: (b -> a -> b) -> (a -> b) -> [a] -> [b] biFold :: (a -> a -> b) -> [a] -> [b] dependentMap :: (a -> a -> b) -> (a -> b) -> [a] -> [b] bin :: (Double -> Double) -> [Double] -> [(Double, Int)] lowerOf :: Double -> Double -> Double group :: (Ord a) => [a] -> [(a, Int)] groupSeq :: (Eq a) => [a] -> [(a, Int)] instance GHC.Classes.Eq Stochastic.Tools.Datagram instance GHC.Show.Show Stochastic.Tools.Datagram module Stochastic.Distribution.Discrete class DiscreteDistribution g where rands n g0 = statefully (rand) n g0 rand :: DiscreteDistribution g => g -> (Int, g) rands :: DiscreteDistribution g => Int -> g -> ([Int], g) cdf :: DiscreteDistribution g => g -> Int -> Double cdf' :: DiscreteDistribution g => g -> Double -> Int pmf :: DiscreteDistribution g => g -> Int -> Double module Stochastic.Distributions data UniformBase stdBase :: Int -> UniformBase data Empirical Empirical :: Int -> (Double -> Double) -> (Double -> Double) -> Empirical [degreesOfFreedom] :: Empirical -> Int [cdf] :: Empirical -> Double -> Double [cdf'] :: Empirical -> Double -> Double mkEmpirical :: [Double] -> Empirical module Stochastic.Distribution.Continuous class ContinuousDistribution g where rands n g0 = statefully (rand) n g0 pdf g a b = (cdf g b) - (cdf g a) rand :: ContinuousDistribution g => g -> (Double, g) rands :: ContinuousDistribution g => Int -> g -> ([Double], g) cdf :: ContinuousDistribution g => g -> Double -> Double cdf' :: ContinuousDistribution g => g -> Double -> Double pdf :: ContinuousDistribution g => g -> Double -> Double -> Double degreesOfFreedom :: ContinuousDistribution g => g -> Int module Stochastic.Generator class Generator g where type family From g nextN 0 = state $ \ g0 -> ([], g0) nextN n = do { x <- nextG; xs <- nextN (n - 1); return (x : xs) } nextG :: Generator g => State g (From g) nextN :: Generator g => Int -> State g [(From g)] foldWhile :: Generator g => (From g -> a -> a) -> a -> (a -> Bool) -> State g [From g] while :: Generator g => ((From g) -> Bool) -> State g [From g] instance Stochastic.Generator.Generator [a] module Stochastic.Distributions.Continuous mkUniform :: UniformBase -> Dist mkExp :: UniformBase -> Double -> Dist mkNormal :: UniformBase -> Double -> Double -> Dist mkEmpirical :: UniformBase -> [Double] -> Dist data Dist Uniform :: UniformBase -> Dist Exponential :: Double -> UniformBase -> Dist Normal :: Double -> Double -> (Maybe Double) -> UniformBase -> Dist ChiSquared :: Int -> UniformBase -> Dist Empirical :: Empirical -> UniformBase -> Dist class ContinuousDistribution g where rands n g0 = statefully (rand) n g0 pdf g a b = (cdf g b) - (cdf g a) rand :: ContinuousDistribution g => g -> (Double, g) rands :: ContinuousDistribution g => Int -> g -> ([Double], g) cdf :: ContinuousDistribution g => g -> Double -> Double cdf' :: ContinuousDistribution g => g -> Double -> Double pdf :: ContinuousDistribution g => g -> Double -> Double -> Double degreesOfFreedom :: ContinuousDistribution g => g -> Int instance Stochastic.Distribution.Continuous.ContinuousDistribution Stochastic.Distributions.UniformBase instance Stochastic.Generator.Generator Stochastic.Distributions.Continuous.Dist instance Stochastic.Generator.Generator Stochastic.Distributions.UniformBase instance Stochastic.Distribution.Continuous.ContinuousDistribution Stochastic.Distributions.Continuous.Dist module Stochastic.Distributions.Discrete mkBinomial :: UniformBase -> Double -> Int -> Dist mkBernoulli :: UniformBase -> Double -> Dist mkPoisson :: UniformBase -> Double -> Dist mkZipF :: UniformBase -> Int -> Double -> Dist mkGeometric :: UniformBase -> Double -> Dist data Dist Uniform :: Int -> Int -> UniformBase -> Dist Poisson :: Dist -> Dist Geometric :: Double -> UniformBase -> Dist Bernoulli :: Double -> UniformBase -> Dist Binomial :: Int -> Double -> DiscreteCache -> UniformBase -> Dist ZipF :: Int -> Double -> DiscreteCache -> UniformBase -> Dist class DiscreteDistribution g where rands n g0 = statefully (rand) n g0 rand :: DiscreteDistribution g => g -> (Int, g) rands :: DiscreteDistribution g => Int -> g -> ([Int], g) cdf :: DiscreteDistribution g => g -> Int -> Double cdf' :: DiscreteDistribution g => g -> Double -> Int pmf :: DiscreteDistribution g => g -> Int -> Double instance Stochastic.Generator.Generator Stochastic.Distributions.Discrete.Dist instance Stochastic.Distribution.Discrete.DiscreteDistribution Stochastic.Distributions.Discrete.Dist module Stochastic.Analysis chiSquaredTest :: (ContinuousDistribution g) => g -> Empirical -> [Double] -> Double discreteChiSquaredTest :: (DiscreteDistribution g) => g -> Empirical -> [Int] -> Double