Difference between revisions of "Advanced probability functions"
Line 1: | Line 1: | ||
− | [[Category:Analytica User Guide]] | + | [[Category: Analytica User Guide]] |
+ | [[Category: Analytic Distribution Functions]] | ||
<breadcrumbs>Analytica User Guide > Other Functions > {{PAGENAME}}</breadcrumbs> | <breadcrumbs>Analytica User Guide > Other Functions > {{PAGENAME}}</breadcrumbs> | ||
Line 7: | Line 8: | ||
'''BetaFn(a, b):''' The beta function, defined as: | '''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]](). | ||
Line 15: | Line 16: | ||
'''BetaI(x, a, b):''' The incomplete beta function, defined as: | '''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 24: | ||
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<sub>1</sub>»and «n<sub>2</sub>»degrees of freedom have the same variance, is readily obtained from <code>BetaI</code> as: | 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>. | '''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>. | ||
Line 65: | Line 66: | ||
'''CumNormal(x, ''mean, stddev''):''' Returns the cumulative probability: | '''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. | ||
Line 79: | Line 80: | ||
'''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> | |
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 89: | ||
'''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> |
− | + | ||
See more at [[Dawson]](). | See more at [[Dawson]](). | ||
Line 96: | Line 97: | ||
'''Erf(x):''' The error function, defined as: | '''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]](). | ||
Line 110: | Line 111: | ||
'''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 | ||
− | |||
See more at [[Faddeeva]](x). | See more at [[Faddeeva]](x). | ||
Line 118: | Line 117: | ||
'''GammaFn(x):''' Returns the gamma function of «x», defined as: | '''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]](). | ||
Line 128: | Line 127: | ||
'''GammaI(x, a, ''b''):''' Returns the incomplete gamma function, defined as: | '''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 140: | Line 139: | ||
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]](). | ||
Line 152: | Line 151: | ||
'''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> | |
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. | ||
Line 160: | Line 159: | ||
'''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> | |
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== |
Revision as of 00:34, 8 March 2016
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().
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()
- CumNormal()
- CumNormalInv()
- Erf()
- ErfInv()
- GammaFn()
- GammaI()
- GammaIInv()
- Logit()
- Sigmoid()
- Distribution Densities Library
Enable comment auto-refresher