Safe Haskell | None |
---|---|
Language | Haskell98 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Functions for probability-distributions.
CAVEAT
- Because data-constructors are exposed,
isValid
need not be called.
- class Distribution probabilityDistribution where
- generatePopulation :: (Fractional sample, RandomGen randomGen) => probabilityDistribution -> randomGen -> [sample]
- getMean :: Fractional mean => probabilityDistribution -> mean
- getStandardDeviation :: Floating standardDeviation => probabilityDistribution -> standardDeviation
- getVariance :: Floating variance => probabilityDistribution -> variance
- data ContinuousDistribution parameter
- = ExponentialDistribution parameter
- | LogNormalDistribution parameter parameter
- | NormalDistribution parameter parameter
- | UniformDistribution (Interval parameter)
- data DiscreteDistribution parameter
- = PoissonDistribution parameter
- | ShiftedGeometricDistribution parameter
- maxPreciseInteger :: RealFloat a => a -> Integer
- boxMullerTransform :: (Floating f, Ord f, Show f) => (f, f) -> (f, f)
- generateStandardizedNormalDistribution :: (RealFloat f, Show f, Random f, RandomGen randomGen) => randomGen -> [f]
- generateContinuousPopulation :: (RealFloat f, Show f, Random f, RandomGen randomGen) => ContinuousDistribution f -> randomGen -> [f]
- generateDiscretePopulation :: (Integral sample, Ord parameter, RealFloat parameter, Show parameter, Random parameter, RandomGen randomGen) => DiscreteDistribution parameter -> randomGen -> [sample]
Type-classes
class Distribution probabilityDistribution where Source
Defines a common interface for probability-distributions.
:: (Fractional sample, RandomGen randomGen) | |
=> probabilityDistribution | |
-> randomGen | A generator of uniformly distributed random numbers. |
-> [sample] | CAVEAT: the integers generated for discrete distributions are represented by a fractional type; use |
:: Fractional mean | |
=> probabilityDistribution | |
-> mean | The theoretical mean. |
:: Floating standardDeviation | |
=> probabilityDistribution | |
-> standardDeviation | The theoretical standard-deviation. |
:: Floating variance | |
=> probabilityDistribution | |
-> variance | The theoretical variance. |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (DiscreteDistribution parameter) | |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (ContinuousDistribution parameter) |
Types
Data-types
data ContinuousDistribution parameter Source
Describes continuous probability-distributions; http://en.wikipedia.org/wiki/List_of_probability_distributions#Continuous_distributions.
ExponentialDistribution parameter | Defines an Exponential-distribution with a particular lambda; http://en.wikipedia.org/wiki/Exponential_distribution. |
LogNormalDistribution parameter parameter | Defines a distribution whose logarithm is normally distributed with a particular mean & variance; http://en.wikipedia.org/wiki/Lognormal. |
NormalDistribution parameter parameter | Defines a Normal-distribution with a particular mean & variance; http://en.wikipedia.org/wiki/Normal_distribution. |
UniformDistribution (Interval parameter) | Defines a Uniform-distribution within a closed interval; http://en.wikipedia.org/wiki/Uniform_distribution. |
Eq parameter => Eq (ContinuousDistribution parameter) | |
Read parameter => Read (ContinuousDistribution parameter) | |
Show parameter => Show (ContinuousDistribution parameter) | |
(Floating parameter, Ord parameter, Show parameter) => SelfValidator (ContinuousDistribution parameter) | |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (ContinuousDistribution parameter) |
data DiscreteDistribution parameter Source
Describes discrete probability-distributions; http://en.wikipedia.org/wiki/List_of_probability_distributions#Discrete_distributions.
PoissonDistribution parameter | Defines an Poisson-distribution with a particular lambda; http://en.wikipedia.org/wiki/Poisson_distribution. |
ShiftedGeometricDistribution parameter | Defines an Geometric-distribution with a particular probability of success; http://en.wikipedia.org/wiki/Geometric_distribution. |
Eq parameter => Eq (DiscreteDistribution parameter) | |
Read parameter => Read (DiscreteDistribution parameter) | |
Show parameter => Show (DiscreteDistribution parameter) | |
(Num parameter, Ord parameter, Show parameter) => SelfValidator (DiscreteDistribution parameter) | |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (DiscreteDistribution parameter) |
Functions
maxPreciseInteger :: RealFloat a => a -> Integer Source
The maximum integer which can be accurately represented as a Double.
:: (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. |
- Converts a pair of independent uniformly distributed random numbers, within the semi-closed unit interval (0,1], to a pair of independent normally distributed random numbers, of standardized mean=0, and variance=1.
- http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform.
generateStandardizedNormalDistribution :: (RealFloat f, Show f, Random f, RandomGen randomGen) => randomGen -> [f] Source
- Uses the supplied random-number generator, to generate a conceptually infinite list, of normally distributed random numbers, with standardized mean=0, and variance=1.
- http://en.wikipedia.org/wiki/Normal_distribution, http://mathworld.wolfram.com/NormalDistribution.html.
generateContinuousPopulation Source
:: (RealFloat f, Show f, Random f, RandomGen randomGen) | |
=> ContinuousDistribution f | |
-> randomGen | A generator of uniformly distributed random numbers. |
-> [f] |
Uses the supplied random-number generator, to generate a conceptually infinite population, with the specified continuous probability-distribution.
generateDiscretePopulation Source
:: (Integral sample, Ord parameter, RealFloat parameter, Show parameter, Random parameter, RandomGen randomGen) | |
=> DiscreteDistribution parameter | |
-> randomGen | A generator of uniformly distributed random numbers. |
-> [sample] |
Uses the supplied random-number generator, to generate a conceptually infinite population, with the specified discrete probability-distribution.