public class NegativeBinomial extends AbstractDiscreteDistribution
Instance methods operate on a user supplied uniform random number generator; they are unsynchronized.
Implementation: High performance implementation. Compound method.
J.H. Ahrens, U. Dieter (1974): Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing 12, 223--246.
Modifier and Type | Field and Description |
---|---|
protected Gamma |
gamma |
protected int |
n |
protected double |
p |
protected Poisson |
poisson |
protected static NegativeBinomial |
shared |
randomGenerator
serialVersionUID
Constructor and Description |
---|
NegativeBinomial(int n,
double p,
RandomEngine randomGenerator)
Constructs a Negative Binomial distribution.
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(int k)
Returns the cumulative distribution function.
|
Object |
clone()
Returns a deep copy of the receiver; the copy will produce identical sequences.
|
int |
nextInt()
Returns a random number from the distribution.
|
int |
nextInt(int n,
double p)
Returns a random number from the distribution; bypasses the internal state.
|
double |
pdf(int k)
Returns the probability distribution function.
|
void |
setNandP(int n,
double p)
Sets the parameters number of trials and the probability of success.
|
static int |
staticNextInt(int n,
double p)
Returns a random number from the distribution with the given parameters n and p.
|
String |
toString()
Returns a String representation of the receiver.
|
nextDouble
apply, apply, getRandomGenerator, makeDefaultGenerator, setRandomGenerator
protected int n
protected double p
protected Gamma gamma
protected Poisson poisson
protected static NegativeBinomial shared
public NegativeBinomial(int n, double p, RandomEngine randomGenerator)
n
- the number of trials.p
- the probability of success.randomGenerator
- a uniform random number generator.public double cdf(int k)
public Object clone()
clone
in class AbstractDistribution
public int nextInt()
nextInt
in class AbstractDiscreteDistribution
public int nextInt(int n, double p)
public double pdf(int k)
public void setNandP(int n, double p)
n
- the number of trialsp
- the probability of success.public static int staticNextInt(int n, double p)
n
- the number of trialsp
- the probability of success.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.