|
||||||||||
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.BinomialDistributionImpl
public class BinomialDistributionImpl
The default implementation of BinomialDistribution
.
Field Summary |
---|
Fields inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
---|
randomData |
Constructor Summary | |
---|---|
BinomialDistributionImpl(int trials,
double p)
Create a binomial distribution with the given number of trials and probability of success. |
Method Summary | |
---|---|
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 |
getNumberOfTrials()
Access the number of trials for this distribution. |
double |
getNumericalMean()
Returns the mean. |
double |
getNumericalVariance()
Returns the variance. |
double |
getProbabilityOfSuccess()
Access the probability of success for this distribution. |
int |
getSupportLowerBound()
Returns the lower bound of the support for the distribution. |
int |
getSupportUpperBound()
Returns the upper bound of the support for the distribution. |
int |
inverseCumulativeProbability(double p)
For this distribution, X, this method returns the largest x, such that P(X ≤ x) ≤ p . |
double |
probability(int x)
For this distribution, X, this method returns P(X = x). |
void |
setNumberOfTrials(int trials)
Deprecated. as of 2.1 (class will become immutable in 3.0) |
void |
setProbabilityOfSuccess(double p)
Deprecated. as of 2.1 (class will become immutable in 3.0) |
Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
---|
cumulativeProbability, cumulativeProbability, cumulativeProbability, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, reseedRandomGenerator, sample, sample |
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 |
Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution |
---|
probability |
Methods inherited from interface org.apache.commons.math.distribution.Distribution |
---|
cumulativeProbability, cumulativeProbability |
Constructor Detail |
---|
public BinomialDistributionImpl(int trials, double p)
trials
- the number of trials.p
- the probability of success.Method Detail |
---|
public int getNumberOfTrials()
getNumberOfTrials
in interface BinomialDistribution
public double getProbabilityOfSuccess()
getProbabilityOfSuccess
in interface BinomialDistribution
@Deprecated public void setNumberOfTrials(int trials)
setNumberOfTrials
in interface BinomialDistribution
trials
- the new number of trials.
IllegalArgumentException
- if trials
is not a valid
number of trials.@Deprecated public void setProbabilityOfSuccess(double p)
setProbabilityOfSuccess
in interface BinomialDistribution
p
- the new probability of success.
IllegalArgumentException
- if p
is not a valid
probability.protected int getDomainLowerBound(double p)
p
, used to
bracket a PDF root.
getDomainLowerBound
in class AbstractIntegerDistribution
p
- the desired probability for the critical value
p
protected int getDomainUpperBound(double p)
p
, used to
bracket a PDF root.
getDomainUpperBound
in class AbstractIntegerDistribution
p
- the desired probability for the critical value
p
public double cumulativeProbability(int x) throws MathException
cumulativeProbability
in interface IntegerDistribution
cumulativeProbability
in class AbstractIntegerDistribution
x
- the value at which the PDF is evaluated.
MathException
- if the cumulative probability can not be computed
due to convergence or other numerical errors.public double probability(int x)
probability
in interface IntegerDistribution
x
- the value at which the PMF is evaluated.
public int inverseCumulativeProbability(double p) throws MathException
p
.
Returns -1
for p=0 and Integer.MAX_VALUE
for
p=1.
inverseCumulativeProbability
in interface IntegerDistribution
inverseCumulativeProbability
in class AbstractIntegerDistribution
p
- the desired probability
MathException
- if the inverse cumulative probability can not be
computed due to convergence or other numerical errors.
IllegalArgumentException
- if p < 0 or p > 1public int getSupportLowerBound()
public int getSupportUpperBound()
public double getNumericalMean()
n
number of trials and
probability parameter p
, the mean is
n * p
public double getNumericalVariance()
n
number of trials and
probability parameter p
, the variance is
n * p * (1 - p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |