public class BinomialDistributionImpl extends AbstractIntegerDistribution implements BinomialDistribution, java.io.Serializable
BinomialDistribution.| Constructor and Description |
|---|
BinomialDistributionImpl(int trials,
double p)
Create a binomial distribution with the given number of trials and
probability of success.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cumulativeProbability(int x)
For this distribution, X, this method returns P(X ≤ x).
|
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)
|
cumulativeProbability, cumulativeProbability, cumulativeProbability, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, reseedRandomGenerator, sample, sampleequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcumulativeProbabilityprobabilitycumulativeProbability, cumulativeProbabilitypublic BinomialDistributionImpl(int trials,
double p)
trials - the number of trials.p - the probability of success.public int getNumberOfTrials()
getNumberOfTrials in interface BinomialDistributionpublic double getProbabilityOfSuccess()
getProbabilityOfSuccess in interface BinomialDistribution@Deprecated public void setNumberOfTrials(int trials)
setNumberOfTrials in interface BinomialDistributiontrials - the new number of trials.java.lang.IllegalArgumentException - if trials is not a valid
number of trials.@Deprecated public void setProbabilityOfSuccess(double p)
setProbabilityOfSuccess in interface BinomialDistributionp - the new probability of success.java.lang.IllegalArgumentException - if p is not a valid
probability.public double cumulativeProbability(int x)
throws MathException
cumulativeProbability in interface IntegerDistributioncumulativeProbability in class AbstractIntegerDistributionx - 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 IntegerDistributionx - 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 IntegerDistributioninverseCumulativeProbability in class AbstractIntegerDistributionp - the desired probabilityMathException - if the inverse cumulative probability can not be
computed due to convergence or other numerical errors.java.lang.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 * ppublic double getNumericalVariance()
n number of trials and
probability parameter p, the variance is
n * p * (1 - p)Copyright © 2010 - 2023 Adobe. All Rights Reserved