Difference between revisions of "Advanced probability functions"
m (Promoted each function to a heading.) |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Analytica User Guide]] | + | [[Category: Analytica User Guide]] |
− | <breadcrumbs>Analytica User Guide > | + | [[Category: Analytic Distribution Functions]] |
+ | <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: | ||
− | + | :<math> | |
BetaFn(a, b) = \int\limits_{0}^{1}x^{a -1}(1-x)^{b-1}dx | BetaFn(a, b) = \int\limits_{0}^{1}x^{a -1}(1-x)^{b-1}dx | ||
− | </math | + | </math> |
See more at [[BetaFn]](). | See more at [[BetaFn]](). | ||
− | + | ==BetaI(x, a, b)== | |
+ | The incomplete beta function, defined as: | ||
− | + | :<math> | |
BetaI(x, a, b) = \frac{1}{Beta(a,b)}\int\limits_{0}^{X}x^{a -1}(1-x)^{b-1}dx | BetaI(x, a, b) = \frac{1}{Beta(a,b)}\int\limits_{0}^{X}x^{a -1}(1-x)^{b-1}dx | ||
− | </math | + | </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 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. | ||
Line 23: | Line 26: | ||
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: | 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> | |
Pr = BetaI(p, k, n - k + 1) | Pr = BetaI(p, k, n - k + 1) | ||
− | </math | + | </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: | 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> | |
Student(x|n) = 1 - BetaI(n/(n + x^2), n/2, 1/2) | Student(x|n) = 1 - BetaI(n/(n + x^2), n/2, 1/2) | ||
− | </math | + | </math> |
− | The F-distribution, used to test whether two observed samples with «n< | + | The F-distribution, used to test whether two observed samples with «n<sub>1</sub>»and «n<sub>2</sub>»degrees of freedom have the same variance, is readily obtained from <code>BetaI</code> as: |
− | + | :<math> | |
F(x, n_1, n_2) = BetaI(_2 / (n_{1}x + n_2)) | F(x, n_1, n_2) = BetaI(_2 / (n_{1}x + n_2)) | ||
− | </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>. | ||
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>. | ||
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). | ||
:<code>Combinations(2, 4) → 6</code> | :<code>Combinations(2, 4) → 6</code> | ||
Line 55: | 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. | ||
:<code>Permutations(2, 4) → 12</code> | :<code>Permutations(2, 4) → 12</code> | ||
Line 63: | Line 70: | ||
See more at [[Permutations]](). | See more at [[Permutations]](). | ||
− | + | ==Partitions(k, n)== | |
+ | The number of ways to form «k» non-empty groups from a bucket of «n» items. | ||
− | < | + | :<code>Partitions(2, 4) → 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> | ||
p = Pr[x ≤ X] | p = Pr[x ≤ X] | ||
− | </math | + | </math> |
for a normal distribution with a given mean and standard deviation. «mean» and «stddev» are optional and default to «mean» = 0, «stddev» = 1. | for a normal distribution with a given mean and standard deviation. «mean» and «stddev» are optional and default to «mean» = 0, «stddev» = 1. | ||
− | :code>CumNormal(1) - CumNormal(-1) → .683</code> | + | :<code>CumNormal(1) - CumNormal(-1) → .683</code> |
− | That is, 68.3% of the area under a normal distribution is contained within one standard deviation | + | That is, 68.3% of the area under a normal distribution is contained within one standard deviation of the mean. |
− | of the mean. | ||
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: | ||
− | + | :<math> | |
p = Pr[x ≤ X] | p = Pr[x ≤ X] | ||
− | </math | + | </math> |
«mean» and «stddev» are optional and default to «mean» = 0, «stddev» = 1. | «mean» and «stddev» are optional and default to «mean» = 0, «stddev» = 1. | ||
Line 88: | Line 106: | ||
See more at [[CumNormalInv]](). | See more at [[CumNormalInv]](). | ||
− | + | ==Dawson(x)== | |
+ | The Dawson function, or Dawson integral, defined as: | ||
+ | |||
+ | :<math>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> | |
Erf(x) = \frac{2}{\sqrt{\pi}}\int\limits_0^{\infty}e^{-t^2}dt | Erf(x) = \frac{2}{\sqrt{\pi}}\int\limits_0^{\infty}e^{-t^2}dt | ||
− | </math | + | </math> |
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>. | ||
:<code>ErfInv(Erf(2)) → 2</code> | :<code>ErfInv(Erf(2)) → 2</code> | ||
Line 102: | 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: | ||
+ | |||
+ | :<math>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> | ||
\Gamma(x) = \int\limits_0^{\infty}t^{x - 1}e^{-t}dt | \Gamma(x) = \int\limits_0^{\infty}t^{x - 1}e^{-t}dt | ||
− | </math | + | </math> |
− | The gamma function grows very quickly. For example, when ''n'' is an integer, <code>GammaFn(n+1) = n!</code>. For this reason, it is often preferable to use the [[LGamma]]() function. | + | The gamma function grows very quickly. For example, when ''n'' is an integer, <code>GammaFn(n + 1) = n!</code>. For this reason, it is often preferable to use the [[LGamma]]() function. |
See more at [[GammaFn]](). | See more at [[GammaFn]](). | ||
− | + | ==GammaI(x, a, ''b'')== | |
+ | Returns the incomplete gamma function, defined as: | ||
− | + | :<math> | |
Gamma I (x, a, ''b'') = \frac{1}{\Gamma(a)}\int\limits_0^{x/b}e^{-t}t^{b-1}dt | Gamma I (x, a, ''b'') = \frac{1}{\Gamma(a)}\int\limits_0^{x/b}e^{-t}t^{b-1}dt | ||
− | </math | + | </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 . | «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 . | ||
Line 126: | Line 163: | ||
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). | 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> | |
P(x < k) = GammaI(k, a) | P(x < k) = GammaI(k, a) | ||
− | </math | + | </math> |
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. | ||
See more at [[GammaIInv]](). | See more at [[GammaIInv]](). | ||
− | + | ==Logit(p)== | |
+ | The ''logit'' function, or ''log-odds function'', is defined for 0 < «p» < 1 as | ||
− | + | :<math> | |
Logit(p) = \ln(\frac{p}{1 - p}) | Logit(p) = \ln(\frac{p}{1 - p}) | ||
− | </math | + | </math> |
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 | ||
− | + | :<math> | |
Sigmoid(x) = \frac{1}{1 + exp(-x)} | Sigmoid(x) = \frac{1}{1 + exp(-x)} | ||
− | </math | + | </math> |
− | The inverse of the [[Sigmoid]] | + | The inverse of the [[Sigmoid]] function is the [[Logit]] function. |
==See Also== | ==See Also== | ||
+ | <div style="column-count:2;-moz-column-count:2;-webkit-column-count:2"> | ||
* [[BetaFn]]() | * [[BetaFn]]() | ||
* [[BetaI]]() | * [[BetaI]]() | ||
Line 158: | Line 199: | ||
* [[Combinations]]() | * [[Combinations]]() | ||
* [[Permutations]]() | * [[Permutations]]() | ||
+ | * [[Partitions]]() | ||
* [[CumNormal]]() | * [[CumNormal]]() | ||
* [[CumNormalInv]]() | * [[CumNormalInv]]() | ||
Line 167: | Line 209: | ||
* [[Logit]]() | * [[Logit]]() | ||
* [[Sigmoid]]() | * [[Sigmoid]]() | ||
− | <footer> | + | * [[Distribution Densities Library]] |
+ | </div> | ||
+ | |||
+ | |||
+ | <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
- BetaFn()
- BetaI()
- BetaIaInv()
- Combinations()
- Permutations()
- Partitions()
- CumNormal()
- CumNormalInv()
- Erf()
- ErfInv()
- GammaFn()
- GammaI()
- GammaIInv()
- Logit()
- Sigmoid()
- Distribution Densities Library
Enable comment auto-refresher