|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math.distribution.AbstractDistribution
org.apache.commons.math.distribution.AbstractIntegerDistribution
org.apache.commons.math.distribution.PascalDistributionImpl
public class PascalDistributionImpl
The default implementation of PascalDistribution.
| Field Summary |
|---|
| Fields inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
|---|
randomData |
| Constructor Summary | |
|---|---|
PascalDistributionImpl(int r,
double p)
Create a Pascal distribution with the given number of trials and probability of success. |
|
| Method Summary | |
|---|---|
protected double |
calculateNumericalMean()
Use this method to actually calculate the mean for the specific distribution. |
protected double |
calculateNumericalVariance()
Use this method to actually calculate the variance for the specific distribution. |
double |
cumulativeProbability(int x)
For this distribution, X, this method returns P(X <= x). |
protected int |
getDomainLowerBound(double p)
Access the domain value lower bound, based on p, used to
bracket a PDF root. |
protected int |
getDomainUpperBound(double p)
Access the domain value upper bound, based on p, used to
bracket a PDF root. |
int |
getNumberOfSuccesses()
Access the number of successes for this distribution. |
double |
getProbabilityOfSuccess()
Access the probability of success for this distribution. |
int |
getSupportLowerBound()
Access the lower bound of the support. |
int |
getSupportUpperBound()
Access the upper bound of the support. |
int |
inverseCumulativeProbability(double p)
For this distribution, X, this method returns the largest
x, such that P(X <= x) <= p. |
boolean |
isSupportUpperBoundInclusive()
Use this method to get information about whether the upper bound of the support is inclusive or not. |
double |
probability(int x)
For this distribution, X, this method returns P(X = x). |
| Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
|---|
cumulativeProbability, cumulativeProbability, cumulativeProbability, isSupportLowerBoundInclusive, probability, reseedRandomGenerator, sample, sample |
| Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution |
|---|
getNumericalMean, getNumericalVariance, isSupportConnected |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.commons.math.distribution.IntegerDistribution |
|---|
cumulativeProbability, reseedRandomGenerator, sample, sample |
| Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution |
|---|
probability |
| Methods inherited from interface org.apache.commons.math.distribution.Distribution |
|---|
cumulativeProbability, cumulativeProbability, getNumericalMean, getNumericalVariance, isSupportConnected, isSupportLowerBoundInclusive |
| Constructor Detail |
|---|
public PascalDistributionImpl(int r,
double p)
r - Number of successes.p - Probability of success.| Method Detail |
|---|
public int getNumberOfSuccesses()
getNumberOfSuccesses in interface PascalDistributionpublic double getProbabilityOfSuccess()
getProbabilityOfSuccess in interface PascalDistributionprotected int getDomainLowerBound(double p)
p, used to
bracket a PDF root.
getDomainLowerBound in class AbstractIntegerDistributionp - Desired probability for the critical value.
P(X < 'lower bound') < p.protected int getDomainUpperBound(double p)
p, used to
bracket a PDF root.
getDomainUpperBound in class AbstractIntegerDistributionp - Desired probability for the critical value
P(X < 'upper bound') > p.public double cumulativeProbability(int x)
X, this method returns P(X <= x).
cumulativeProbability in interface IntegerDistributioncumulativeProbability in class AbstractIntegerDistributionx - Value at which the PDF is evaluated.
public double probability(int x)
X, this method returns P(X = x).
probability in interface IntegerDistributionx - Value at which the PMF is evaluated.
public int inverseCumulativeProbability(double p)
X, this method returns the largest
x, such that P(X <= x) <= p.
It will return -1 when p = 0 and Integer.MAX_VALUE when p = 1.
inverseCumulativeProbability in interface IntegerDistributioninverseCumulativeProbability in class AbstractIntegerDistributionp - Desired probability.
x such that P(X <= x) <= p.
OutOfRangeException - if p < 0 or p > 1.public int getSupportLowerBound()
getSupportLowerBound in class AbstractIntegerDistributionpublic int getSupportUpperBound()
Integer.MAX_VALUE together with
isSupportUpperBoundInclusive() being false
getSupportUpperBound in class AbstractIntegerDistributionInteger.MAX_VALUE for positive infinity)protected double calculateNumericalMean()
AbstractDistribution.getNumericalMean()
(which implements caching) to actually get the mean.
For number of successes r and
probability of success p, the mean is
( r * p ) / ( 1 - p )
calculateNumericalMean in class AbstractDistributionprotected double calculateNumericalVariance()
AbstractDistribution.getNumericalVariance()
(which implements caching) to actually get the variance.
For number of successes r and
probability of success p, the mean is
( r * p ) / ( 1 - p )^2
calculateNumericalVariance in class AbstractDistributionpublic boolean isSupportUpperBoundInclusive()
isSupportUpperBoundInclusive in interface DistributionisSupportUpperBoundInclusive in class AbstractIntegerDistribution
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||