Implementation of a real-valued EnumeratedDistribution.
Values with zero-probability are allowed but they do not extend the
support.
Duplicate values are allowed. Probabilities of duplicate values are combined
when computing cumulative probabilities and statistics.
| Modifier and Type | Field and Description |
|---|---|
| protected final EnumeratedDistribution | innerDistribution
|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| public | EnumeratedRealDistribution(final double[]
array of random variable values. singletons, final double[] array of probabilities. probabilities)Create a discrete real-valued distribution using the given probability mass function enumeration. |
| public | EnumeratedRealDistribution(final RandomGenerator
random number generator. rng, final double[] array of random variable values. singletons, final double[] array of probabilities. probabilities)Create a discrete real-valued distribution using the given random number generator and probability mass function enumeration. |
| public | EnumeratedRealDistribution(final RandomGenerator
random number generator used for sampling rng, final double[] input dataset data)Create a discrete real-valued distribution from the input data. |
| public | EnumeratedRealDistribution(final double[]
input dataset data)Create a discrete real-valued distribution from the input data. |
| Modifier and Type | Method and Description |
|---|---|
| private static List | Returns: list of value/probability pairsvalues singletons, double[] probabilities probabilities)Create the list of Pairs representing the distribution from singletons and probabilities. |
| public double | cumulativeProbability(final double
the point at which the CDF is evaluated x)Implements org. For a random variable |
| public double | Returns: the value of the probability mass function at pointxthe point at which the PMF is evaluated x)Implements org. For a random variable |
| public double | Returns: sum(singletons[i] * probabilities[i])Implements org. Use this method to get the numerical value of the mean of this distribution. |
| public double | Returns: sum((singletons[i] - mean) ^ 2 * probabilities[i])Implements org. Use this method to get the numerical value of the variance of this distribution. |
| public double | Returns: the lowest value with non-zero probability.Implements org. Access the lower bound of the support. |
| public double | Returns: the highest value with non-zero probability.Implements org. Access the upper bound of the support. |
| public double | inverseCumulativeProbability(final double
the cumulative probability p)Overrides org. Implements org. Computes the quantile function of this distribution. |
| public boolean | Returns: trueImplements org. Use this method to get information about whether the support is connected, i.e. whether all values between the lower and upper bound of the support are included in the support. |
| public boolean | Returns: trueImplements org. Whether or not the lower bound of support is in the domain of the density function. |
| public boolean | Returns: trueImplements org. Whether or not the upper bound of support is in the domain of the density function. |
| public double | probability(final double
the point at which the PMF is evaluated x)Overrides org. Implements org. For a random variable |
| public double | sample()
Overrides org. Implements org. Generate a random value sampled from this distribution. |
| innerDistribution | back to summary |
|---|---|
| protected final EnumeratedDistribution<Double> innerDistribution
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serializable UID. | |
| EnumeratedRealDistribution | back to summary |
|---|---|
| public EnumeratedRealDistribution(final double[] singletons, final double[] probabilities) throws DimensionMismatchException, NotPositiveException, MathArithmeticException, NotFiniteNumberException, NotANumberException Create a discrete real-valued distribution using the given probability mass function enumeration. Note this constructor will implicitly create an instance of
| |
| EnumeratedRealDistribution | back to summary |
|---|---|
| public EnumeratedRealDistribution(final RandomGenerator rng, final double[] singletons, final double[] probabilities) throws DimensionMismatchException, NotPositiveException, MathArithmeticException, NotFiniteNumberException, NotANumberException Create a discrete real-valued distribution using the given random number generator and probability mass function enumeration.
| |
| EnumeratedRealDistribution | back to summary |
|---|---|
| public EnumeratedRealDistribution(final RandomGenerator rng, final double[] data) Create a discrete real-valued distribution from the input data. Values are assigned mass based on their frequency.
| |
| EnumeratedRealDistribution | back to summary |
|---|---|
| public EnumeratedRealDistribution(final double[] data) Create a discrete real-valued distribution from the input data. Values are assigned mass based on their frequency. For example, [0,1,1,2] as input creates a distribution with values 0, 1 and 2 having probability masses 0.25, 0.5 and 0.25 respectively,
| |
| createDistribution | back to summary |
|---|---|
| private static List Create the list of Pairs representing the distribution from singletons and probabilities. | |
| cumulativeProbability | back to summary |
|---|---|
| public double cumulativeProbability(final double x) Implements org. Doc from org. For a random variable
| |
| density | back to summary |
|---|---|
| public double density(final double x) Implements org. For a random variable
| |
| getNumericalMean | back to summary |
|---|---|
| public double getNumericalMean() Implements org. Doc from org. Use this method to get the numerical value of the mean of this distribution.
| |
| getNumericalVariance | back to summary |
|---|---|
| public double getNumericalVariance() Implements org. Doc from org. Use this method to get the numerical value of the variance of this distribution.
| |
| getSupportLowerBound | back to summary |
|---|---|
| public double getSupportLowerBound() Implements org. Doc from org. Access the lower bound of the support. This method must return the same
value as
| |
| getSupportUpperBound | back to summary |
|---|---|
| public double getSupportUpperBound() Implements org. Doc from org. Access the upper bound of the support. This method must return the same
value as
| |
| inverseCumulativeProbability | back to summary |
|---|---|
| public double inverseCumulativeProbability(final double p) throws OutOfRangeException Overrides org. Implements org. Doc from org. Computes the quantile function of this distribution. For a random
variable
| |
| isSupportConnected | back to summary |
|---|---|
| public boolean isSupportConnected() Implements org. Doc from org. Use this method to get information about whether the support is connected, i.e. whether all values between the lower and upper bound of the support are included in the support. The support of this distribution is connected.
| |
| isSupportLowerBoundInclusive | back to summary |
|---|---|
| public boolean isSupportLowerBoundInclusive() Implements org. Doc from org. Whether or not the lower bound of support is in the domain of the density
function. Returns true iff
| |
| isSupportUpperBoundInclusive | back to summary |
|---|---|
| public boolean isSupportUpperBoundInclusive() Implements org. Doc from org. Whether or not the upper bound of support is in the domain of the density
function. Returns true iff
| |
| probability | back to summary |
|---|---|
| public double probability(final double x) Overrides org. Implements org. Doc from org. For a random variable
| |
| sample | back to summary |
|---|---|
| public double sample() Overrides org. Implements org. Doc from org. Generate a random value sampled from this distribution. The default implementation uses the inversion method.
| |