Difference between revisions of "Advanced probability functions"

m (Promoted each function to a heading.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category: Analytica User Guide]]
 
[[Category: Analytica User Guide]]
 
[[Category: Analytic Distribution Functions]]
 
[[Category: Analytic Distribution Functions]]
<breadcrumbs>Analytica User Guide > Other Functions > {{PAGENAME}}</breadcrumbs>
+
<breadcrumbs>Analytica User Guide > Probability Distributions > {{PAGENAME}}</breadcrumbs>
  
  
 
The following functions are not actual probability distributions, but they are useful for various probabilistic analyses, including building other probability distributions. You can find them in the Advanced math library from the Definition menu.
 
The following functions are not actual probability distributions, but they are useful for various probabilistic analyses, including building other probability distributions. You can find them in the Advanced math library from the Definition menu.
  
'''BetaFn(a, b):''' The beta function, defined as:
+
==BetaFn(a, b)==
 +
The beta function, defined as:
  
 
:<math>
 
:<math>
Line 14: Line 15:
 
See more at [[BetaFn]]().
 
See more at [[BetaFn]]().
  
'''BetaI(x, a, b):''' The incomplete beta function, defined as:
+
==BetaI(x, a, b)==
 +
The incomplete beta function, defined as:
  
 
:<math>
 
:<math>
Line 40: Line 42:
 
</math>
 
</math>
  
'''BetaIaInv(p, x, b):''' The inverse of the incomplete beta function with respect to the second parameter, «a». Returns the value a such that <code>BetaI(x, a, b) = p</code>.
+
==BetaIaInv(p, x, b)==
 +
The inverse of the incomplete beta function with respect to the second parameter, «a». Returns the value a such that <code>BetaI(x, a, b) = p</code>.
  
 
See more at [[BetaIaInv]]().
 
See more at [[BetaIaInv]]().
  
'''BetaIInv(p, a, b):''' The inverse of the incomplete beta function with respect to the first parameter, «x». Returns the value «x» such that <code>BetaI(x, a, b) = p</code>.
+
==BetaIInv(p, a, b)==
 +
The inverse of the incomplete beta function with respect to the first parameter, «x». Returns the value «x» such that <code>BetaI(x, a, b) = p</code>.
  
 
See more at [[BetaIInv]]().
 
See more at [[BetaIInv]]().
  
'''Combinations(k, n):''' «n» choose «k». The number of unique ways that «k» items can be chosen from a set of «n» elements (without replacement and ignoring the order).
+
==Combinations(k, n)==
 +
«n» choose «k». The number of unique ways that «k» items can be chosen from a set of «n» elements (without replacement and ignoring the order).
  
 
:<code>Combinations(2, 4) &rarr; 6</code>
 
:<code>Combinations(2, 4) &rarr; 6</code>
Line 56: Line 61:
 
See more at [[Combinations]]().
 
See more at [[Combinations]]().
  
'''Permutations(k, n):''' The number of possible permutations of «k» items taken from a bucket of «n» items.
+
==Permutations(k, n)==
 +
The number of possible permutations of «k» items taken from a bucket of «n» items.
  
 
:<code>Permutations(2, 4) &rarr; 12</code>
 
:<code>Permutations(2, 4) &rarr; 12</code>
Line 64: Line 70:
 
See more at [[Permutations]]().
 
See more at [[Permutations]]().
  
'''CumNormal(x, ''mean, stddev''):''' Returns the cumulative probability:
+
==Partitions(k, n)==
 +
The number of ways to form «k» non-empty groups from a bucket of «n» items.
 +
 
 +
:<code>Partitions(2, 4) &rarr; 7</code>
 +
 
 +
:They are (with bar '|' separating groups): {1|2,3,4}, {2|1,3,4}, {3|1,2,4}, {4|1,2,3}, {1,2|3,4}, {1,3|2,4}, {1,4|2,3}
 +
 
 +
See more at [[Partitions]]().
 +
 
 +
 
 +
==CumNormal(x, ''mean, stddev'')==
 +
Returns the cumulative probability:
  
 
:<math>
 
:<math>
Line 78: Line 95:
 
See more at [[CumNormal]]().
 
See more at [[CumNormal]]().
  
'''CumNormalInv(p, ''m, s''):''' The inverse cumulative probability function for a normal distribution with mean «m» and standard deviation «s». This is also called the ''Probit function''. Returns the value «X» where:
+
==CumNormalInv(p, ''m, s'')==
 +
The inverse cumulative probability function for a normal distribution with mean «m» and standard deviation «s». This is also called the ''Probit function''. Returns the value «X» where:
  
 
:<math>
 
:<math>
Line 88: Line 106:
 
See more at [[CumNormalInv]]().
 
See more at [[CumNormalInv]]().
  
'''Dawson(x)''': The Dawson function, or Dawson integral, defined as:
+
==Dawson(x)==
 +
The Dawson function, or Dawson integral, defined as:
  
 
:<math>Dawson(x) = e^{-x^2} \int_0^x e^{t^2} dt</math>
 
:<math>Dawson(x) = e^{-x^2} \int_0^x e^{t^2} dt</math>
Line 95: Line 114:
 
See more at [[Dawson]]().
 
See more at [[Dawson]]().
  
'''Erf(x):''' The error function, defined as:
+
==Erf(x)==
 +
The error function, defined as:
  
 
:<math>
 
:<math>
Line 103: Line 123:
 
See more at [[Erf]]().
 
See more at [[Erf]]().
  
'''ErfInv(y):''' The inverse error function. Returns the value «X» such that <code>Erf(X) = y</code>.
+
==ErfInv(y)==
 +
The inverse error function. Returns the value «X» such that <code>Erf(X) = y</code>.
  
 
:<code>ErfInv(Erf(2)) &rarr; 2</code>
 
:<code>ErfInv(Erf(2)) &rarr; 2</code>
Line 109: Line 130:
 
See more at [[ErfInv]]().
 
See more at [[ErfInv]]().
  
'''Faddeeva(x):''' The Faddeeva function, also known as the Kramp function, defined for complex numbers as:
+
==Faddeeva(x)==
 +
The Faddeeva function, also known as the Kramp function, defined for complex numbers as:
  
 
:<math>w(z) = e^{-z^2} \left( 1 - { 2 \over\sqrt{-\pi}} \int_0^z e^{t^2} dt \right)</math>
 
:<math>w(z) = e^{-z^2} \left( 1 - { 2 \over\sqrt{-\pi}} \int_0^z e^{t^2} dt \right)</math>
Line 115: Line 137:
 
See more at [[Faddeeva]](x).
 
See more at [[Faddeeva]](x).
  
'''GammaFn(x):''' Returns the gamma function of «x», defined as:
+
==GammaFn(x)==
 +
Returns the gamma function of «x», defined as:
  
 
:<math>
 
:<math>
Line 125: Line 148:
 
See more at [[GammaFn]]().
 
See more at [[GammaFn]]().
  
'''GammaI(x, a, ''b''):''' Returns the incomplete gamma function, defined as:
+
==GammaI(x, a, ''b'')==
 +
Returns the incomplete gamma function, defined as:
  
 
:<math>
 
:<math>
Line 145: Line 169:
 
See more at [[GammaI]]().
 
See more at [[GammaI]]().
  
'''GammaIInv(y, a, ''b''):''' The inverse of the incomplete gamma function. Returns the value «x» such that <code>GammaI(x, a, b) = y</code>. «b» is optional and defaults to 1.
+
==GammaIInv(y, a, ''b'')==
 +
The inverse of the incomplete gamma function. Returns the value «x» such that <code>GammaI(x, a, b) = y</code>. «b» is optional and defaults to 1.
  
 
See more at [[GammaIInv]]().
 
See more at [[GammaIInv]]().
  
'''Logit(p):''' The ''logit'' function, or ''log-odds function'', is defined for 0 < «p» < 1 as
+
==Logit(p)==
 +
The ''logit'' function, or ''log-odds function'', is defined for 0 < «p» < 1 as
  
 
:<math>
 
:<math>
Line 157: Line 183:
 
The inverse of the [[Logit]] function is the [[Sigmoid]] function.
 
The inverse of the [[Logit]] function is the [[Sigmoid]] function.
  
'''Sigmoid(x):''' The sigmoid function approaches 0 as «x» approaches <math>-\infty</math>  and approaches 1 as «x» approaches <math>\infty</math>, crossing 0.5 at «x»=0. It is also sometimes called the ''expit function'' or the ''inverse logit function''. It is defined as
+
==Sigmoid(x)==
 +
The sigmoid function approaches 0 as «x» approaches <math>-\infty</math>  and approaches 1 as «x» approaches <math>\infty</math>, crossing 0.5 at «x»=0. It is also sometimes called the ''expit function'' or the ''inverse logit function''. It is defined as
  
 
:<math>
 
:<math>
Line 166: Line 193:
  
 
==See Also==
 
==See Also==
 +
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">
 
* [[BetaFn]]()
 
* [[BetaFn]]()
 
* [[BetaI]]()
 
* [[BetaI]]()
Line 171: Line 199:
 
* [[Combinations]]()
 
* [[Combinations]]()
 
* [[Permutations]]()
 
* [[Permutations]]()
 +
* [[Partitions]]()
 
* [[CumNormal]]()
 
* [[CumNormal]]()
 
* [[CumNormalInv]]()
 
* [[CumNormalInv]]()
Line 181: Line 210:
 
* [[Sigmoid]]()
 
* [[Sigmoid]]()
 
* [[Distribution Densities Library]]
 
* [[Distribution Densities Library]]
 +
</div>
 +
  
<footer>Financial library functions / {{PAGENAME}} / Expressing Uncertainty</footer>
+
<footer>Special probabilistic functions/ {{PAGENAME}} / Multivariate distributions</footer>

Latest revision as of 22:34, 3 July 2024


The following functions are not actual probability distributions, but they are useful for various probabilistic analyses, including building other probability distributions. You can find them in the Advanced math library from the Definition menu.

BetaFn(a, b)

The beta function, defined as:

[math]\displaystyle{ BetaFn(a, b) = \int\limits_{0}^{1}x^{a -1}(1-x)^{b-1}dx }[/math]

See more at BetaFn().

BetaI(x, a, b)

The incomplete beta function, defined as:

[math]\displaystyle{ BetaI(x, a, b) = \frac{1}{Beta(a,b)}\int\limits_{0}^{X}x^{a -1}(1-x)^{b-1}dx }[/math]

The incomplete beta function BetaI() is equal to the cumulative probability of the beta distribution at «x». It is useful in a number of mathematical and statistical applications.

The cumulative binomial distribution, defined as the probability that an event with probability «p» occurs «k» or more times in «n» trials, is given by:

[math]\displaystyle{ Pr = BetaI(p, k, n - k + 1) }[/math]

The student’s distribution with n degrees of freedom, used to test whether two observed distributions have the same mean, is readily available from the beta distribution as:

[math]\displaystyle{ Student(x|n) = 1 - BetaI(n/(n + x^2), n/2, 1/2) }[/math]

The F-distribution, used to test whether two observed samples with «n1»and «n2»degrees of freedom have the same variance, is readily obtained from BetaI as:

[math]\displaystyle{ F(x, n_1, n_2) = BetaI(_2 / (n_{1}x + n_2)) }[/math]

BetaIaInv(p, x, b)

The inverse of the incomplete beta function with respect to the second parameter, «a». Returns the value a such that BetaI(x, a, b) = p.

See more at BetaIaInv().

BetaIInv(p, a, b)

The inverse of the incomplete beta function with respect to the first parameter, «x». Returns the value «x» such that BetaI(x, a, b) = p.

See more at BetaIInv().

Combinations(k, n)

«n» choose «k». The number of unique ways that «k» items can be chosen from a set of «n» elements (without replacement and ignoring the order).

Combinations(2, 4) → 6

They are: {1,2}, {1,3}, {1,4}, {2,3}, {2,4}, {3,4}

See more at Combinations().

Permutations(k, n)

The number of possible permutations of «k» items taken from a bucket of «n» items.

Permutations(2, 4) → 12
They are: {1,2}, {1,3}, {1,4}, {2,1}, {2,3}, {2,4}, {3,1}, {3,2}, {3,4}, {4,1}, {4,2}, {4,3}

See more at Permutations().

Partitions(k, n)

The number of ways to form «k» non-empty groups from a bucket of «n» items.

Partitions(2, 4) → 7
They are (with bar '|' separating groups): {1|2,3,4}, {2|1,3,4}, {3|1,2,4}, {4|1,2,3}, {1,2|3,4}, {1,3|2,4}, {1,4|2,3}

See more at Partitions().


CumNormal(x, mean, stddev)

Returns the cumulative probability:

[math]\displaystyle{ p = Pr[x ≤ X] }[/math]

for a normal distribution with a given mean and standard deviation. «mean» and «stddev» are optional and default to «mean» = 0, «stddev» = 1.

CumNormal(1) - CumNormal(-1) → .683

That is, 68.3% of the area under a normal distribution is contained within one standard deviation of the mean.

See more at CumNormal().

CumNormalInv(p, m, s)

The inverse cumulative probability function for a normal distribution with mean «m» and standard deviation «s». This is also called the Probit function. Returns the value «X» where:

[math]\displaystyle{ p = Pr[x ≤ X] }[/math]

«mean» and «stddev» are optional and default to «mean» = 0, «stddev» = 1.

See more at CumNormalInv().

Dawson(x)

The Dawson function, or Dawson integral, defined as:

[math]\displaystyle{ Dawson(x) = e^{-x^2} \int_0^x e^{t^2} dt }[/math]


See more at Dawson().

Erf(x)

The error function, defined as:

[math]\displaystyle{ Erf(x) = \frac{2}{\sqrt{\pi}}\int\limits_0^{\infty}e^{-t^2}dt }[/math]

See more at Erf().

ErfInv(y)

The inverse error function. Returns the value «X» such that Erf(X) = y.

ErfInv(Erf(2)) → 2

See more at ErfInv().

Faddeeva(x)

The Faddeeva function, also known as the Kramp function, defined for complex numbers as:

[math]\displaystyle{ w(z) = e^{-z^2} \left( 1 - { 2 \over\sqrt{-\pi}} \int_0^z e^{t^2} dt \right) }[/math]

See more at Faddeeva(x).

GammaFn(x)

Returns the gamma function of «x», defined as:

[math]\displaystyle{ \Gamma(x) = \int\limits_0^{\infty}t^{x - 1}e^{-t}dt }[/math]

The gamma function grows very quickly. For example, when n is an integer, GammaFn(n + 1) = n!. For this reason, it is often preferable to use the LGamma() function.

See more at GammaFn().

GammaI(x, a, b)

Returns the incomplete gamma function, defined as:

[math]\displaystyle{ Gamma I (x, a, ''b'') = \frac{1}{\Gamma(a)}\int\limits_0^{x/b}e^{-t}t^{b-1}dt }[/math]

«a» is the shape parameter, «b» is an optional scale factor (default «b»=1). Some textbooks use λ = 1/«a» as the scale factor. The incomplete gamma function is defined for «x» ≥ 0 .

The incomplete gamma function returns the cumulative area from zero to «x» under the gamma distribution.

The incomplete gamma function is useful in a number of mathematical and statistical contexts.

The cumulative Poisson distribution function, which encodes the probability that the number of Poisson random events («x») occurring will be less than k (where k is an integer) where the expected mean number is a, is given by (recall that parameter «b» is optional).

[math]\displaystyle{ P(x \lt k) = GammaI(k, a) }[/math]

See more at GammaI().

GammaIInv(y, a, b)

The inverse of the incomplete gamma function. Returns the value «x» such that GammaI(x, a, b) = y. «b» is optional and defaults to 1.

See more at GammaIInv().

Logit(p)

The logit function, or log-odds function, is defined for 0 < «p» < 1 as

[math]\displaystyle{ Logit(p) = \ln(\frac{p}{1 - p}) }[/math]

The inverse of the Logit function is the Sigmoid function.

Sigmoid(x)

The sigmoid function approaches 0 as «x» approaches [math]\displaystyle{ -\infty }[/math] and approaches 1 as «x» approaches [math]\displaystyle{ \infty }[/math], crossing 0.5 at «x»=0. It is also sometimes called the expit function or the inverse logit function. It is defined as

[math]\displaystyle{ Sigmoid(x) = \frac{1}{1 + exp(-x)} }[/math]

The inverse of the Sigmoid function is the Logit function.

See Also


Comments


You are not allowed to post comments.