package umontreal.iro.lecuyer.randvar;
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
/**
* THIS CLASS HAS BEEN RENAMED {@link InverseGammaGen}.
*
*
* This class implements random variate generators for
* the Pearson type V distribution with shape parameter
*
* α > 0 and scale parameter β > 0.
* The density function of this distribution is
*
*
*
* f (x) = (x-(α+1)exp-β/x)/(β-αΓ(α)) for x > 0,
*
* and f (x) = 0 otherwise,
* where Γ is the gamma function.
*
*/
public class Pearson5Gen extends RandomVariateGen {
protected double alpha;
protected double beta;
/**
* THIS CLASS HAS BEEN RENAMED {@link InverseGammaGen}.
* Creates a Pearson5 random variate generator with parameters
* α = alpha and β = beta, using stream s.
*
*/
public Pearson5Gen (RandomStream s, double alpha, double beta) {
super (s, new Pearson5Dist(alpha, beta));
setParams(alpha, beta);
}
/**
* Creates a Pearson5 random variate generator with parameters
* α = alpha and β = 1, using stream s.
*
*/
public Pearson5Gen (RandomStream s, double alpha) {
this (s, alpha, 1.0);
}
/**
* Creates a new generator for the distribution dist,
* using stream s.
*
*/
public Pearson5Gen (RandomStream s, Pearson5Dist dist) {
super (s, dist);
if (dist != null)
setParams(dist.getAlpha(), dist.getBeta());
}
/**
* Generates a variate from the Pearson V distribution
* with shape parameter
* α > 0 and scale parameter β > 0.
*
*/
public static double nextDouble (RandomStream s,
double alpha, double beta) {
return Pearson5Dist.inverseF (alpha, beta, s.nextDouble());
}
/**
* Returns the parameter α of this object.
*
*/
public double getAlpha() {
return alpha;
}
/**
* Returns the parameter β of this object.
*
*/
public double getBeta() {
return beta;
}
protected void setParams (double alpha, double beta) {
if (alpha <= 0.0)
throw new IllegalArgumentException ("alpha <= 0");
if (beta <= 0.0)
throw new IllegalArgumentException ("beta <= 0");
this.alpha = alpha;
this.beta = beta;
}
}
Ads help maintain this website.