-- 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.3.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.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 type Gen g a = g -> (a, g) data IOGen g a IOGen :: (g -> (a, g)) -> (MVar g) -> IOGen g a liftGen :: (g -> (a, g)) -> g -> IO (IOGen g a) nextIO :: IOGen g a -> IO a foldGenWhile :: (g -> (a, g)) -> (b -> a -> b) -> b -> (b -> Bool) -> (g -> ([a], g)) genWhile :: (g -> (a, g)) -> (a -> Bool) -> (g -> ([a], g)) genTake :: (g -> (a, g)) -> Integer -> (g -> ([a], g)) dropGen :: (g -> (a, g)) -> Integer -> g -> g dropIO :: IOGen g a -> Integer -> IO () module Stochastic.Uniform -- | For information on the performance of the xorshift-128-plus PRNG, -- please see: Vigna et al. xorshift128plus :: Integer -> UniformRandom data UniformRandom nWayAllocate :: Integer -> Integer -> UniformRandom -> ([UniformRandom], UniformRandom) splitAllocate :: Integer -> UniformRandom -> (UniformRandom, UniformRandom) -- | The class RandomGen provides a common interface to random -- number generators. class RandomGen g -- | The next operation returns an Int that is uniformly -- distributed in the range returned by genRange (including both -- end points), and a new generator. next :: RandomGen g => g -> (Int, g) -- | The genRange operation yields the range of values returned by -- the generator. -- -- It is required that: -- --
-- -- The second condition ensures that genRange cannot examine its -- argument, and hence the value it returns can be determined only by the -- instance of RandomGen. That in turn allows an implementation to -- make a single call to genRange to establish a generator's -- range, without being concerned that the generator returned by (say) -- next might have a different range to the generator passed to -- next. -- -- The default definition spans the full range of Int. genRange :: RandomGen g => g -> (Int, Int) -- | The split operation allows one to obtain two distinct random -- number generators. This is very useful in functional programs (for -- example, when passing a random number generator down to recursive -- calls), but very little work has been done on statistically robust -- implementations of split ([System.Random\#Burton, -- System.Random\#Hellekalek] are the only examples we know of). split :: RandomGen g => g -> (g, g) instance GHC.Classes.Eq Stochastic.Uniform.EntropyExhausted instance GHC.Exception.Exception Stochastic.Uniform.EntropyExhausted instance GHC.Show.Show Stochastic.Uniform.EntropyExhausted instance System.Random.RandomGen Stochastic.Uniform.UniformRandom module Stochastic.Distributions data UniformBase stdBase :: Integer -> UniformBase seededBase :: IO 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.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.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.Distribution.Discrete.DiscreteDistribution Stochastic.Distributions.Discrete.Dist module Stochastic.Analysis chiSquaredTest :: (ContinuousDistribution g) => g -> Empirical -> [Double] -> Double discreteChiSquaredTest :: (DiscreteDistribution g) => g -> Empirical -> [Int] -> Double