statistics v0.5.0 Statistics.Distributions.Normal

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.

Link to this section Summary

Functions

The cumulative density function

Probability density function

The percentile-point function

Draw a random number from a normal distribution

Link to this section Functions

Link to this function cdf()
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

Link to this function cdf(mu, sigma)
cdf(number(), number()) :: (... -> any())
Link to this function pdf()
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
Link to this function pdf(mu, sigma)
pdf(number(), number()) :: (... -> any())
Link to this function ppf()
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
Link to this function ppf(mu, sigma)
ppf(number(), number()) :: (... -> any())
Link to this function rand()
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
Link to this function rand(mu, sigma)
rand(number(), number()) :: number()