查function
Title
[D] functions -- Functions
Description
This is a quick reference for the probability distributions and density functions. For help on all functions, see [D] functions.
Probability distributions and density functions
The probability distribution and density functions are organized under the following headings:
Beta and noncentral beta distributions
Binomial distribution
Chi-squared and noncentral chi-squared distributions
Dunnett's multiple range distribution
F and noncentral F distributions
Gamma distribution
Hypergeometric distribution
Negative binomial distribution
Normal (Gaussian), log of the normal, and binormal distributions
Poisson distribution
Student's t and noncentral Student's t distributions
Tukey's Studentized range distribution
Beta and noncentral beta distributions
ibeta(a,b,x)
Domain a: 1e-10 to 1e+17
Domain b: 1e-10 to 1e+17
Domain x: -8e+307 to 8e+307
Interesting domain is 0 < x < 1
Range: 0 to 1
Description: returns the cumulative beta distribution with shape parameters a and b
returns 0 if x < 0.
returns 1 if x > 1.
ibeta() returns the regularized incomplete beta function, also known as the incomplete beta function ratio. The incomplete beta
function without regularization is given by
(gamma(a)*gamma(b)/gamma(a+b))*ibeta(a,b,x)
or, better when a or b might be large,
exp(lngamma(a)+lngamma(b)-lngamma(a+b))*ibeta(a,b,x).
Here is an example of the use of the regularized incomplete beta function. Although Stata has a cumulative binomial function (see
binomial()), the probability that an event occurs k or fewer times in n trials, when the probability of one event is p, can be
evaluated as cond(k==n,1,1-ibeta(k+1,n-k,p)). The reverse cumulative binomial (the probability that an event occurs k or more
times) can be evaluated as cond(k==0,1,ibeta(k,n-k+1,p)).
betaden(a,b,x)
Domain a: 1e-323 to 8e+307
Domain b: 1e-323 to 8e+307
Domain x: -8e+307 to 8e+307
Interesting domain is 0 < x < 1
Range: 0 to 8e+307
Description: returns the probability density of the beta distribution, where a and b are shape parameters.
returns 0 if x < 0 or x > 1.
ibetatail(a,b,x)
Domain a: 1e-10 to 1e+17
Domain b: 1e-10 to 1e+17
Domain x: -8e+307 to 8e+307
Interesting domain is 0 < x < 1
Range: 0 to 1
Description: returns the reverse cumulative (upper tail or survivor) beta distribution with shape parameters a and b.
returns 1 if x < 0.
returns 0 if x > 1.
ibetatail() is also known as the complement to the incomplete beta function (ratio).
invibeta(a,b,p)
Domain a: 1e-10 to 1e+17
Domain b: 1e-10 to 1e+17
Domain p: 0 to 1
Range: 0 to 1
Description: returns the inverse cumulative beta distribution: if ibeta(a,b,x) = p, then invibeta(a,b,p) = x.
invibetatail(a,b,p)
Domain a: 1e-10 to 1e+17
Domain b: 1e-10 to 1e+17
Domain p: 0 to 1
Range: 0 to 1
Description: returns the inverse reverse cumulative (upper tail or survivor) beta distribution: if ibetatail(a,b,x) = p, then invibetatail(a,b,p)
= x.
nibeta(a,b,np,x)
Domain a: 1e-323 to 8e+307
Domain b: 1e-323 to 8e+307
Domain np: 0 to 10,000
Domain x: -8e+307 to 8e+307
Interesting domain is 0 < x < 1
Range: 0 to 1
Description: returns the cumulative noncentral beta distribution, where a and b are shape parameters, np is the noncentrality parameter, and x is
the value of a beta random variable.
returns 0 if x < 0.
returns 1 if x > 1.
nibeta(a,b,0,x) = ibeta(a,b,x), but ibeta() is the preferred function to use for the central beta distribution. nibeta() is computed
using an algorithm described in Johnson, Kotz, and Balakrishnan (1995).
nbetaden(a,b,np,x)
Domain a: 1e-323 to 8e+307
Domain b: 1e-323 to 8e+307
Domain np: 0 to 1,000
Domain x: -8e+307 to 8e+307
Interesting domain is 0 < x < 1
Range: 0 to 8e+307
Description: returns the probability density function of the noncentral beta distribution, where a and b are shape parameters, np is the
noncentrality parameter, and x is the value of a beta random variable.
returns 0 if x < 0 or x > 1.
nbetaden(a,b,0,x)= betaden(a,b,x), but betaden() is the preferred function to use for the central beta distribution. nbetaden() is
computed using an algorithm described in Johnson, Kotz, and Balakrishnan (1995).
invnibeta(a,b,np,p)
Domain a: 1e-323 to 8e+307
Domain b: 1e-323 to 8e+307
Domain np: 0 to 1,000
Domain p: 0 to 1
Range: 0 to 1
Description: returns the inverse cumulative noncentral beta distribution: if nibeta(a,b,np,x) = p, then invnibeta(a,b,np,p) = x.
Binomial distribution
binomial(n,k,p)
Domain n: 0 to 1e+17
Domain k: -8e+307 to 8e+307
Interesting domain is 0 < k < n
Domain p: 0 to 1
Range: 0 to 1
Description: returns the probability of observing floor(k) or fewer successes in floor(n) trials when the probability of a success on one trial
is p.
returns 0 if k < 0.
returns 1 if k > n.
binomialp(n,k,p)
Domain n: 1 to 1e+6
Domain k: 0 to n
Domain p: 0 to 1
Range: 0 to 1
Description: returns the probability of observing floor(k) successes in floor(n) trials when the probability of a success on one trial is p.
binomialtail(n,k,p)
Domain n: 0 to 1e+17
Domain k: -8e+307 to 8e+307
Interesting domain is 0 < k < n
Domain p: 0 to 1
Range: 0 to 1
Description: returns the probability of observing floor(k) or more successes in floor(n) trials when the probability of a success on one trial is
p.
returns 1 if k < 0.
returns 0 if k > n.
invbinomial(n,k,p)
Domain n: 1 to 1e+17
Domain k: 0 to n - 1
Domain p: 0 to 1 (exclusive)
Range: 0 to 1
Description: returns the inverse of the cumulative binomial; that is, it returns the probability of success on one trial such that the
probability of observing floor(k) or fewer successes in floor(n) trials is p.
invbinomialtail(n,k,p)
Domain n: 1 to 1e+17
Domain k: 1 to n
Domain p: 0 to 1 (exclusive)
Range: 0 to 1
Description: returns the inverse of the right cumulative binomial; that is, it returns the probability of success on one trial such that the
probability of observing floor(k) or more successes in floor(n) trials is p.