|
|||||||||||
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.HypergeometricDistributionImpl
The default implementation of HypergeometricDistribution
.
Field Summary | |
private int |
numberOfSuccesses
The number of successes in the population. |
private int |
populationSize
The population size. |
private int |
sampleSize
The sample size. |
(package private) static long |
serialVersionUID
Serializable version identifier |
Constructor Summary | |
HypergeometricDistributionImpl(int populationSize,
int numberOfSuccesses,
int sampleSize)
Construct a new hypergeometric distribution with the given the population size, the number of successes in the population, and the sample size. |
Method Summary | |
double |
cumulativeProbability(int x)
For this disbution, X, this method returns P(X ≤ x). |
private int[] |
getDomain(int n,
int m,
int k)
Return the domain for the given hypergeometric distribution parameters. |
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. |
private int |
getLowerDomain(int n,
int m,
int k)
Return the lowest domain value for the given hypergeometric distribution parameters. |
int |
getNumberOfSuccesses()
Access the number of successes. |
int |
getPopulationSize()
Access the population size. |
int |
getSampleSize()
Access the sample size. |
private int |
getUpperDomain(int m,
int k)
Return the highest domain value for the given hypergeometric distribution parameters. |
double |
probability(int x)
For this disbution, X, this method returns P(X = x). |
private double |
probability(int n,
int m,
int k,
int x)
For the disbution, X, defined by the given hypergeometric distribution parameters, this method returns P(X = x). |
void |
setNumberOfSuccesses(int num)
Modify the number of successes. |
void |
setPopulationSize(int size)
Modify the population size. |
void |
setSampleSize(int size)
Modify the sample size. |
Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
cumulativeProbability, cumulativeProbability, inverseCumulativeProbability, probability |
Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution |
cumulativeProbability |
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, inverseCumulativeProbability |
Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution |
probability |
Methods inherited from interface org.apache.commons.math.distribution.Distribution |
cumulativeProbability, cumulativeProbability |
Field Detail |
static final long serialVersionUID
private int numberOfSuccesses
private int populationSize
private int sampleSize
Constructor Detail |
public HypergeometricDistributionImpl(int populationSize, int numberOfSuccesses, int sampleSize)
populationSize
- the population size.numberOfSuccesses
- number of successes in the population.sampleSize
- the sample size.Method Detail |
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.private int[] getDomain(int n, int m, int k)
n
- the population size.m
- number of successes in the population.k
- the sample size.
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
private int getLowerDomain(int n, int m, int k)
n
- the population size.m
- number of successes in the population.k
- the sample size.
public int getNumberOfSuccesses()
getNumberOfSuccesses
in interface HypergeometricDistribution
public int getPopulationSize()
getPopulationSize
in interface HypergeometricDistribution
public int getSampleSize()
getSampleSize
in interface HypergeometricDistribution
private int getUpperDomain(int m, int k)
m
- number of successes in the population.k
- the sample size.
public double probability(int x)
probability
in interface IntegerDistribution
x
- the value at which the PMF is evaluated.
private double probability(int n, int m, int k, int x)
n
- the population size.m
- number of successes in the population.k
- the sample size.x
- the value at which the PMF is evaluated.
public void setNumberOfSuccesses(int num)
setNumberOfSuccesses
in interface HypergeometricDistribution
num
- the new number of successes.
java.lang.IllegalArgumentException
- if num
is negative.public void setPopulationSize(int size)
setPopulationSize
in interface HypergeometricDistribution
size
- the new population size.
java.lang.IllegalArgumentException
- if size
is not positive.public void setSampleSize(int size)
setSampleSize
in interface HypergeometricDistribution
size
- the new sample size.
java.lang.IllegalArgumentException
- if size
is negative.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |