factory-0.2.0.5: Rational arithmetic in an irrational world.

Safe Haskell None

Factory.Math.Probability

Contents

Description

`AUTHOR`
Dr. Alistair Ward
`DESCRIPTION`
Miscellaneous functions for probability-distributions.

Synopsis

# Types

## Data-types

Constructors

 UniformDistribution (Interval f) Defines a Uniform-distribution within a closed interval; http://en.wikipedia.org/wiki/Uniform_distribution. NormalDistribution f f Defines a Normal-distribution with a particular mean and variance; http://en.wikipedia.org/wiki/Normal_distribution.

Instances

 Eq f => Eq (ContinuousDistribution f) Read f => Read (ContinuousDistribution f) Show f => Show (ContinuousDistribution f) (Num a, Ord a, Show a) => SelfValidator (ContinuousDistribution a)

Constructors

 PoissonDistribution f

Instances

 Eq f => Eq (DiscreteDistribution f) Read f => Read (DiscreteDistribution f) Show f => Show (DiscreteDistribution f) (Num f, Ord f, Show f) => SelfValidator (DiscreteDistribution f)

# Functions

Arguments

 :: (Floating f, Ord f, Show f) => (f, f) Independent, uniformly distributed random numbers, which must be within the semi-closed unit interval, (0,1]. -> (f, f) Independent, normally distributed random numbers, with standardized mean=0 and variance=1.

generateStandardizedNormalDistribution :: (RealFloat f, Show f, Random f, RandomGen randomGen) => randomGen -> [f]Source

Arguments

 :: (RealFloat f, Show f, Random f, RandomGen randomGen) => Int number of items. -> ContinuousDistribution f -> randomGen A generator of uniformly distributed random numbers. -> [f]
• Generates a random sample-population, with the specified continuous probability-distribution.
• When a Normal distribution is requested, the generated population will only tend towards the requested mean and variance of, as the sample-size tends towards infinity. Whilst one could arrange for these criteria to be precisely met for any sample-size, the sample would lose a degree of randomness as a result.

Arguments

 :: (Integral events, RealFloat lambda, Show lambda, Random lambda, RandomGen randomGen) => lambda Defines the required approximate value of both mean and variance. -> randomGen -> [events]
• Uses the supplied random-number generator, to generate a conceptually infinite list, of random integers conforming to the Poisson distribution (mean=lambda, variance=lambda).
• http://en.wikipedia.org/wiki/Poisson_distribution.
• CAVEAT: uses an algorithm by Knuth, which having a linear time-complexity in lambda, can be intolerably slow; also, the term `exp \$ negate lambda`, underflows for large lambda; so for large lambda, this implementation returns the appropriate `NormalDistribution`, which is similar for large lambda.

Arguments

 :: (Ord f, RealFloat f, Show f, Random f, RandomGen randomGen, Integral events) => Int number of items. -> DiscreteDistribution f -> randomGen A generator of uniformly distributed random numbers. -> [events]

Generates a random sample-population, with the specified discrete probability-distribution.