public class BinomialDistribution extends Object implements Distribution
Constructor and Description |
---|
BinomialDistribution(int n,
double p)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
BigDecimal |
getCumulativeProbabilityAt(double x,
MathContext mathContext)
Returns the cumulative density function value at a given position.
|
BigDecimal |
getDescendingCumulativeProbabilityAt(double x,
MathContext mathContext)
Returns the cumulative density function value at a given position when
starting from the high values.
|
BigDecimal |
getMaxValueForProbability(double p,
MathContext mathContext)
The value after which the density function will be smaller than p.
|
BigDecimal |
getMinValueForProbability(double p,
MathContext mathContext)
The value before which the density function will be smaller than p.
|
BigInteger |
getNBI()
Returns n as BigInteger.
|
BigDecimal |
getOneMinusPBigDecimal()
Returns 1-p as big decimal.
|
BigDecimal |
getPBigDecimal()
Returns p as big decimal.
|
BigDecimal |
getProbabilityAt(double x,
MathContext mathContext)
Returns the density function value at a given position.
|
BigDecimal |
getSmallestCumulativeProbabilityAt(double x,
MathContext mathContext)
Returns the cumulative density function value at a given position, starting from the low values if before the median, from the high otherwise.
|
BigDecimal |
getValueAtCumulativeProbability(double p,
MathContext mathContext)
The value after which the cumulative density function will be smaller
than p.
|
BigDecimal |
getValueAtDescendingCumulativeProbability(double p,
MathContext mathContext)
The value after which the cumulative density function will be smaller
than p when starting from high values.
|
public BinomialDistribution(int n, double p)
n
- the number of trialsp
- the probability of success of each trialpublic BigInteger getNBI()
public BigDecimal getPBigDecimal()
public BigDecimal getOneMinusPBigDecimal()
public BigDecimal getProbabilityAt(double x, MathContext mathContext)
Distribution
getProbabilityAt
in interface Distribution
x
- the position of interestmathContext
- the math context to use for calculationpublic BigDecimal getCumulativeProbabilityAt(double x, MathContext mathContext) throws org.apache.commons.math.MathException
Distribution
getCumulativeProbabilityAt
in interface Distribution
x
- the position of interestmathContext
- the math context to use for calculationorg.apache.commons.math.MathException
- if a MathException occurspublic BigDecimal getDescendingCumulativeProbabilityAt(double x, MathContext mathContext) throws org.apache.commons.math.MathException
Distribution
getDescendingCumulativeProbabilityAt
in interface Distribution
x
- the position of interestmathContext
- the math context to use for calculationorg.apache.commons.math.MathException
- if a MathException occurspublic BigDecimal getSmallestCumulativeProbabilityAt(double x, MathContext mathContext) throws org.apache.commons.math.MathException
Distribution
getSmallestCumulativeProbabilityAt
in interface Distribution
x
- the position of interestmathContext
- the math context to use for calculationorg.apache.commons.math.MathException
- if a MathException occurspublic BigDecimal getMaxValueForProbability(double p, MathContext mathContext)
Distribution
getMaxValueForProbability
in interface Distribution
p
- the probability of interestmathContext
- the math context to use for calculationpublic BigDecimal getMinValueForProbability(double p, MathContext mathContext)
Distribution
getMinValueForProbability
in interface Distribution
p
- the probability of interestmathContext
- the math context to use for calculationpublic BigDecimal getValueAtCumulativeProbability(double p, MathContext mathContext) throws org.apache.commons.math.MathException
Distribution
getValueAtCumulativeProbability
in interface Distribution
p
- the probability of interestmathContext
- the math context to use for calculationorg.apache.commons.math.MathException
- if a MathException occurspublic BigDecimal getValueAtDescendingCumulativeProbability(double p, MathContext mathContext) throws org.apache.commons.math.MathException
Distribution
getValueAtDescendingCumulativeProbability
in interface Distribution
p
- the probability of interestmathContext
- the math context to use for calculationorg.apache.commons.math.MathException
- if a MathException occursCopyright © 2015. All rights reserved.