Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Functions for probability-distributions.
CAVEAT
- Because data-constructors are exposed,
isValid
need not be called.
- class Distribution probabilityDistribution where
- 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.
generatePopulation :: (Fractional sample, RandomGen randomGen) => probabilityDistribution -> randomGen -> [sample] Source #
getMean :: Fractional mean => probabilityDistribution -> mean Source #
getStandardDeviation :: Floating standardDeviation => probabilityDistribution -> standardDeviation Source #
getVariance :: Floating variance => probabilityDistribution -> variance Source #
(RealFloat parameter, Show parameter, Random parameter) => Distribution (DiscreteDistribution parameter) Source # | |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (ContinuousDistribution parameter) Source # | |
Types
Data-types
data ContinuousDistribution parameter Source #
Describes continuous probability-distributions; https://en.wikipedia.org/wiki/List_of_probability_distributions#Continuous_distributions.
ExponentialDistribution parameter | Defines an Exponential-distribution with a particular lambda; https://en.wikipedia.org/wiki/Exponential_distribution. |
LogNormalDistribution parameter parameter | Defines a distribution whose logarithm is normally distributed with a particular mean & variance; https://en.wikipedia.org/wiki/Lognormal. |
NormalDistribution parameter parameter | Defines a Normal-distribution with a particular mean & variance; https://en.wikipedia.org/wiki/Normal_distribution. |
UniformDistribution (Interval parameter) | Defines a Uniform-distribution within a closed interval; https://en.wikipedia.org/wiki/Uniform_distribution. |
Eq parameter => Eq (ContinuousDistribution parameter) Source # | |
Read parameter => Read (ContinuousDistribution parameter) Source # | |
Show parameter => Show (ContinuousDistribution parameter) Source # | |
(Floating parameter, Ord parameter, Show parameter) => SelfValidator (ContinuousDistribution parameter) Source # | |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (ContinuousDistribution parameter) Source # | |
data DiscreteDistribution parameter Source #
Describes discrete probability-distributions; https://en.wikipedia.org/wiki/List_of_probability_distributions#Discrete_distributions.
PoissonDistribution parameter | Defines an Poisson-distribution with a particular lambda; https://en.wikipedia.org/wiki/Poisson_distribution. |
ShiftedGeometricDistribution parameter | Defines an Geometric-distribution with a particular probability of success; https://en.wikipedia.org/wiki/Geometric_distribution. |
Eq parameter => Eq (DiscreteDistribution parameter) Source # | |
Read parameter => Read (DiscreteDistribution parameter) Source # | |
Show parameter => Show (DiscreteDistribution parameter) Source # | |
(Num parameter, Ord parameter, Show parameter) => SelfValidator (DiscreteDistribution parameter) Source # | |
(RealFloat parameter, Show parameter, Random parameter) => Distribution (DiscreteDistribution parameter) Source # | |
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.
- https://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.
- https://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.