|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.stat.Pdf
public final class Pdf
Probability density functions.
Nested Class Summary | |
---|---|
static class |
Pdf.AltSeriesAccuracyLossException
The magnitude of alternating series sum is too small relative to the sum of positive terms to permit a reliable accuracy. |
Method Summary | |
---|---|
static double |
beta(double x,
double pin,
double qin)
Evaluates the beta probability density function. |
static double |
binomial(int k,
int n,
double pin)
Evaluates the binomial probability density function. |
static double |
chi(double chsq,
double df)
Evaluates the chi-squared probability density function |
static double |
discreteUniform(int x,
int n)
Evaluates the discrete uniform probability density function. |
static double |
exponential(double x,
double scale)
Evaluates the exponential probability density function |
static double |
extremeValue(double x,
double mu,
double beta)
Evaluates the extreme value probability density function. |
static double |
F(double x,
double dfn,
double dfd)
Evaluates the F probability density function. |
static double |
gamma(double x,
double a,
double b)
Evaluates the gamma probability density function. |
static double |
geometric(int x,
double pin)
Evaluates the discrete geometric probability density function. |
static double |
hypergeometric(int k,
int sampleSize,
int defectivesInLot,
int lotSize)
Evaluates the hypergeometric probability density function. |
static double |
logistic(double x,
double mu,
double s)
Evaluates the logistic probability density function. |
static double |
logNormal(double x,
double mu,
double sigma)
Evaluates the standard lognormal probability density function. |
static double |
noncentralBeta(double x,
double shape1,
double shape2,
double lambda)
Evaluates the noncentral beta probability density function (PDF). |
static double |
noncentralChi(double chsq,
double df,
double alam)
Evaluates the noncentral chi-squared probability density function (PDF). |
static double |
noncentralF(double f,
double df1,
double df2,
double lambda)
Evaluates the noncentral F probability density function (PDF). |
static double |
noncentralStudentsT(double t,
double df,
double delta)
Evaluates the noncentral Student's t probability density function. |
static double |
normal(double x,
double mean,
double stdev)
Evaluates the normal (Gaussian) probability density function. |
static double |
Pareto(double x,
double xm,
double k)
Evaluates the Pareto probability density function. |
static double |
poisson(int k,
double theta)
Evaluates the Poisson probability density function. |
static double |
Rayleigh(double x,
double alpha)
Evaluates the Rayleigh probability density function. |
static double |
Weibull(double x,
double gamma,
double alpha)
Evaluates the Weibull probability density function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double beta(double x, double pin, double qin)
x
- a double
, the argument at which the function is to be evaluated.pin
- a double
, the first beta distribution parameter.qin
- a double
, the second beta distribution parameter.
double
, the value of the probability density function at x
.public static double binomial(int k, int n, double pin)
Method binomial
evaluates the probability that a
binomial random variable with parameters n and
p with p=pin takes on the value k. It
does this by computing probabilities of the random variable taking on
the values in its range less than (or the values greater than)
k. These probabilities are computed by the
recursive relationship
To avoid the possibility of underflow, the probabilities are computed forward from 0, if k is not greater than , and are computed backward from n, otherwise. The smallest positive machine number, , is used as the starting value for computing the probabilities, which are rescaled by if forward computation is performed and by if backward computation is done.
For the special case of p = 0,
binomial
is set to 0 if
k is greater than 0 and to
1 otherwise; and for the case p = 1,
binomial
is set to 0 if
k is less than n and to
1 otherwise.
k
- the int
argument for which the binomial distribution function
is to be evaluated.n
- the int
number of Bernoulli trials.pin
- a double
scalar value representing the
probability of success on each independent trial.
double
scalar value representing the probability that
a binomial random variable takes a value equal to k
.public static double chi(double chsq, double df)
chsq
- a double
scalar value representing the argument
at which the function is to be evaluated.df
- a double
scalar value representing the number
of degrees of freedom. df
must be positive.
double
scalar value, the value of the probability density function at chsq
.public static double discreteUniform(int x, int n)
x
- an int
argument for which the discrete
uniform probability density function is to be evaluated.
x
should be a value between the lower
limit 0 and upper limit n
n
- an int
scalar value representing the
upper limit of the discrete uniform distribution.
double
scalar value representing the
probability that a discrete uniform random variable takes a
value equal to x
.public static double exponential(double x, double scale)
x
- a double
scalar value representing the
argument at which the function is to be evaluated.scale
- a double
scalar value representing the scale parameter.
double
scalar value, the value of the probability density function at x
.public static double extremeValue(double x, double mu, double beta)
x
- a double
scalar value representing the
argument at which the function is to be evaluated.mu
- a double
scalar value representing the location parameter.beta
- a double
scalar value representing the scale parameter.
double
scalar value representing the probability density function at x
.public static double F(double x, double dfn, double dfd)
The probability density function of the F distribution is
where and are the shape parametersdfn
and dfd
and is
the gamma function,
.
x
- a double
, the argument at which
the function is to be evaluated.dfn
- a double
, the numerator degrees
of freedom. It must be positive.dfd
- a double
, the denominator degrees
of freedom. It must be positive.
double
, the value of the probability density function at x
.public static double gamma(double x, double a, double b)
a
is the shape parameter and b
is the scale parameter.
x
- a double
scalar value representing the
argument at which the function is to be evaluated.a
- a double
scalar value representing the
shape parameter. This must be positive.b
- a double
scalar value representing the
scale parameter. This must be positive.
double
scalar value, the probability density function at x
.public static double geometric(int x, double pin)
Method geometric
evaluates the geometric distribution
for the number of trials before the first success.
x
- the int
argument for which the geometric
probability function is to be evaluatedpin
- a double
scalar value representing the
probability parameter of the geometric distribution
(the probability of success for each independent trial)
double
scalar value representing the
probability that a geometric random variable takes a
value equal to x
.public static double hypergeometric(int k, int sampleSize, int defectivesInLot, int lotSize)
Method hypergeometric
evaluates the probability
density function of a hypergeometric random variable with parameters
n, l, and m.
The hypergeometric random variable X can be thought
of as the number of items of a given type in a random sample of size
n that is drawn without replacement from a
population of size l containing m
items of this type. The probability density function is:
where i = max(0, n - l + m).
hypergeometric
evaluates the expression using log
gamma functions.
k
- an int
, the argument at which
the function is to be evaluated.sampleSize
- an int
, the sample size, n
.defectivesInLot
- an int
, the number of defectives
in the lot, m
.lotSize
- an int
, the lot size, l
.
double
, the probability that a
hypergeometric random variable takes on a value
equal to k
.public static double logistic(double x, double mu, double s)
The probability density function of the logistic distribution is
where is the location parameter and the scale parameter .
x
- a double
scalar value representing the argument
at which the function is to be evaluated.mu
- a double
scalar value representing the
location parameter.s
- a double
scalar value representing the
scale parameter.
double
scalar value representing the probability
density function at x
.public static double logNormal(double x, double mu, double sigma)
x
- a double
scalar value representing the argument
at which the function is to be evaluated.mu
- a double
scalar value representing the location parameter.sigma
- a double
scalar value representing the shape parameter.
sigma
must be a positive.
double
scalar value representing the probability density function at x
.public static double noncentralBeta(double x, double shape1, double shape2, double lambda)
The noncentral beta distribution is a generalization of the beta distribution. If is a noncentral chi-square random variable with noncentrality parameter and degrees of freedom, and is a chi-square random variable with degrees of freedom which is statistically independent of , then
is a noncentral beta-distributed random variable and
is a noncentral F-distributed random variable. The PDF for noncentral beta variable X can thus be simply defined in terms of the noncentral F PDF:
where is the noncentral beta PDF with = x
,
= shape1
, = shape2
, and noncentrality parameter
= lambda
; is the noncentral F PDF
with argument f, numerator and denominator degrees of freedom and
respectively, and noncentrality parameter ; and
(See documentation for class Cdf
method noncentralF
for a discussion of how the noncentral F PDF
is defined and calculated.)
With a noncentrality parameter of zero, the noncentral beta distribution is the same as the beta distribution.
x
- a double
scalar value representing the argument
at which the function is to be evaluated.
x
must be nonnegative and less than or equal to 1.shape1
- a double
scalar value representing the first
shape parameter. shape1
must be positive.shape2
- a double
scalar value representing the second
shape parameter. shape2
must be positive.lambda
- a double
scalar value representing the noncentrality parameter.
lambda
must nonnegative.
double
scalar value representing the probability density
associated with a noncentral beta random variable with value x
.public static double noncentralChi(double chsq, double df, double alam)
The noncentral chi-squared distribution is a generalization of the chi-squared distribution. If are independent, normally distributed random variables with means and variances , then the random variable
is distributed according to the noncentral chi-squared distribution. The noncentral chi-squared distribution has two parameters, which specifies the number of degrees of freedom (i.e. the number of ), and which is related to the mean of the random variables by
The noncentral chi-squared distribution is equivalent to a (central) chi-squared distribution with degrees of freedom, where is the value of a Poisson distributed random variable with parameter . Thus, the probability density function is given by:
where the (central) chi-squared PDF is given by:
where is the gamma function. The above representation of can be shown to be equivalent to the representation:
Method noncentralChi
evaluates the probability density
function, , of a noncentral chi-squared
random variable with df
degrees of freedom and noncentrality
parameter alam
, corresponding to k = df
,
= alam
, and x =
chsq
.
Method noncentralChi
evaluates the cumulative distribution
function incorporating the above probability density function.
With a noncentrality parameter of zero, the noncentral chi-squared distribution is the same as the central chi-squared distribution.
chsq
- a double
scalar value at which the function
is to be evaluated. chsq
must be nonnegative.df
- a double
scalar value representing the number
of degrees of freedom. df
must be positive.alam
- a double
scalar value representing the
noncentrality parameter. alam
must be nonnegative.
double
scalar value representing the
probability density associated with a noncentral
chi-squared random variable with value chsq
.public static double noncentralF(double f, double df1, double df2, double lambda)
The noncentral F distribution is a generalization of the F distribution. If is a noncentral chi-square random variable with noncentrality parameter and degrees of freedom, and is a chi-square random variable with degrees of freedom which is statistically independent of , then
is a noncentral F-distributed random variable whose PDF is given by: where where is the gamma function, =df1
,
= df2
, = lambda
,
and f = f
.
With a noncentrality parameter of zero, the noncentral F distribution is the same as the F distribution.
The efficiency of the calculation of the above series is enhanced by:
Special cases:
For :
For :
For :
f
- a double
value representing the argument
at which the function is to be evaluated. f
must be nonnegative.df1
- a double
value representing the number
of numerator degrees of freedom. df1
must
be positive.df2
- a double
value representing the number
of denominator degrees of freedom. df2
must
be positive.lambda
- a double
value representing the noncentrality
parameter. lambda
must be nonnegative.
double
value representing the probability
density associated with a noncentral F random
variable with value f
.public static double noncentralStudentsT(double t, double df, double delta) throws Pdf.AltSeriesAccuracyLossException
The noncentral Student's t-distribution is a generalization of the Student's t-distribution. If is a normally distributed random variable with unit variance and mean and is a chi-square random variable with degrees of freedom that is statistically independent of , then
is a noncentral t-distributed random variable with degrees of freedom and noncentrality parameter , that is, with =df
, and = delta
.
The probability density function for the noncentral t-distribution
is:
where
and t = t
.
For noncentrality parameter = 0, the PDF reduces to the (central) Student's t PDF:
and, for t = 0, the PDF becomes: MethodnoncentralStudentsT
evaluates the cumulative
distribution function incorporating the above probability density function.
t
- a double
value representing the argument
at which the function is to be evaluated.df
- a double
value representing the number
of degrees of freedom. df
must be positive.delta
- a double
value representing the
noncentrality parameter.
double
value representing the probability
density associated with a noncentral Student's t
random variable with value t
.
Pdf.AltSeriesAccuracyLossException
- is thrown when the
magnitude of alternating series sum is too small
relative to the sum of positive terms to permit a
reliable accuracy.public static double normal(double x, double mean, double stdev)
The probability density function for a normal distribution is given by
where and are the conditional mean and standard deviation.
x
- a double
scalar value representing the argument
at which the function is to be evaluated.mean
- a double
scalar value containing the mean.stdev
- a double
scalar value containing the standard
deviation.
double
containing the value of the probability
density function at x
public static double Pareto(double x, double xm, double k)
The probability density function of the Pareto distribution is
where the scale parameter and the shape parameter . The function is only defined for
x
- a double
scalar value representing the argument
at which the function is to be evaluated.xm
- a double
scalar value representing the
scale parameter, .k
- a double
scalar value representing the
shape parameter.
double
scalar value representing the probability
density function at x
.public static double poisson(int k, double theta)
Method poisson
evaluates the probability density function of
a Poisson random variable with parameter theta
.
theta
, which is the mean of the Poisson random variable,
must be positive. The probability function (with
) is
poisson
evaluates this function directly, taking
logarithms and using the log gamma function.
k
- the int
argument for which the Poisson
probability function is to be evaluated.theta
- a double
scalar value representing the
mean of the Poisson distribution.
double
scalar value representing the
probability that a Poisson random variable takes a
value equal to k.public static double Rayleigh(double x, double alpha)
x
- a double
scalar value representing the argument
at which the function is to be evaluated. It must be non-negative.alpha
- a double
scalar value representing the scale parameter.
double
scalar value representing the probability density function at x
.public static double Weibull(double x, double gamma, double alpha)
x
- a double
scalar value representing the argument
at which the function is to be evaluated. It must be non-negative.gamma
- a double
scalar value representing the shape parameter.alpha
- a double
scalar value representing the scale parameter.
double
scalar value, the probability density function at x
.
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |