public final class NegativeBinomial extends AbstractDiscreteDistribution
Constructor and Description |
---|
NegativeBinomial(int r,
double p,
Random randomGenerator)
Constructs a Negative Binomial distribution which describes the probability of getting
a particular number of negative trials (k) before getting a fixed number of positive
trials (r) where each positive trial has probability (p) of being successful.
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(int k)
Returns the cumulative distribution function.
|
int |
nextInt() |
int |
nextInt(int r,
double p)
Returns a sample from this distribution.
|
double |
pdf(int k)
Returns the probability distribution function.
|
String |
toString()
Returns a String representation of the receiver.
|
nextDouble
apply, apply, getRandomGenerator, randomDouble, setRandomGenerator
isDensifying
public NegativeBinomial(int r, double p, Random randomGenerator)
r
- the required number of positive trials.p
- the probability of success.randomGenerator
- a uniform random number generator.public double cdf(int k)
public double pdf(int k)
public int nextInt()
nextInt
in class AbstractDistribution
public int nextInt(int r, double p)
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.