Database Reference
In-Depth Information
public static double dchisq(double x,double k) {
return (Math. pow (x,k/2.0 - 1.0)
*Math. exp (-x/2.0))
/(Math. pow (2,k/2.0)*Gamma. gamma (k/2.0));
}
The Gamma.gamma() function in the previous density function is
essentially a continuous version of the factorial distribution. In fact,
Arithmetic.factorial(n) is equal to Gamma.gamma(n-1) .
Exponential, Gamma, and Beta Distributions
If the Poisson distribution is the number of events that occur within a given
time frame, the exponential distribution models the waiting time between
theseevents. ItisoftenusedalongwiththePoisson distribution inmodeling
queues. The distribution has a fairly simple density function with a single
parameter:
public static double dexp(double x,double p ) {
return p *Math. exp (-x* p );
}
The distribution of the waiting time from the first event until the k th event,
when the waiting time between each event is exponentially distributed,
is the gamma distribution . This distribution takes two parameters, the p
parameter (called the rate) from the exponential distribution, and a second
parameter k (called the shape), which represents the number of events.
The density function clearly shows the relationship between the two
distributions:
public static double dgamma(double x,double k,double
p) {
return
Math.pow(p,k)*Math.pow(x,k-1)*Math.exp(-p*x)/
Gamma.gamma(k);
}
The relationship is similar to the one between the geometric distribution
and the negative binomial. Essentially, the exponential distribution is a
special case of the gamma distribution. The chi-square distribution is also
Search WWH ::




Custom Search