Statistics.Distributions.Normal (statistics v0.6.3)
The normal, or gaussian, distribution
When invoking the distibution functions without parameters, a distribution with mean of 0 and standard deviation of 1 is assumed.
Summary
Functions
The cumulative density function
Probability density function
The percentile-point function
Draw a random number from a normal distribution
Functions
cdf()
@spec cdf() :: (... -> any())
The cumulative density function
The probability that a value lies below x
Cumulative gives a probability that a statistic is less than Z. This equates to the area of the distribution below Z. e.g: Pr(Z = 0.69) = 0.7549. This value is usually given in Z tables.
Examples
iex> Statistics.Distributions.Normal.cdf().(2) 0.9772499371127437 iex> Statistics.Distributions.Normal.cdf(0,1).(0) 0.5000000005
cdf(mu, sigma)
pdf()
@spec pdf() :: (... -> any())
Probability density function
Roughly the expectation of a given value in the distribution
Examples
iex> Statistics.Distributions.Normal.pdf().(0)
0.3989422804014327
iex> Statistics.Distributions.Normal.pdf(0.2, 1).(1.3)
0.21785217703255055
pdf(mu, sigma)
ppf()
@spec ppf() :: (... -> any())
The percentile-point function
Get the maximum point which lies below the given probability. This is the inverse of the cdf
Examples
iex> Statistics.Distributions.Normal.ppf().(0.025)
-1.96039491692534
iex> Statistics.Distributions.Normal.ppf(7, 2.1).(0.25)
5.584202805909036
ppf(mu, sigma)
rand()
@spec rand() :: number()
Draw a random number from a normal distribution
rnd/0
will return a random number from a normal distribution
with a mean of 0 and a standard deviation of 1
rnd/2
allows you to provide the mean and standard deviation
parameters of the distribution from which the random number is drawn
Uses the rejection sampling method
Examples
iex> Statistics.Distributions.Normal.rand()
1.5990817245679434
iex> Statistics.Distributions.Normal.rand(22, 2.3)
23.900248900049736