Class DiscreteEmpiricalDistribution

java.lang.Object
nl.tudelft.simulation.jstats.distributions.empirical.AbstractEmpiricalDistribution
nl.tudelft.simulation.jstats.distributions.empirical.DiscreteEmpiricalDistribution
All Implemented Interfaces:
Serializable, EmpiricalDistributionInterface

public class DiscreteEmpiricalDistribution extends AbstractEmpiricalDistribution
The DiscreteEmpiricalDistribution implements the logic for a cumulative distribution function for an empirical distribution, where no interpolation between the given values takes place. The class describes an ordered list of pairs (cumulative probability, value) from which values can be drawn using the inverse function method with a Uniform(0, 1) random distribution, and only provided values will be returned.

Copyright (c) 2021-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.

Author:
Alexander Verbraeck
See Also:
  • Constructor Details

    • DiscreteEmpiricalDistribution

      public DiscreteEmpiricalDistribution(Number[] values, double[] cumulativeProbabilities)
      Construct the empirical distribution based on two arrays of the same length, one with sorted values, and one with corresponding sorted cumulative probabilities. This constructor assumes that the arrays have been properly cloned to avoid changes to their content after the construction of the distribution. Tests for arrays not being equal to null should have been carried out when calling this constructor. Since the values will not be interpolated, the first cumulative probability cannot be 0.0.
      Parameters:
      values - Number[] Number[]; the values belonging to each cumulative probability
      cumulativeProbabilities - double[]; the cumulative probabilities
      Throws:
      NullPointerException - when one of the values is null
      IllegalArgumentException - when cumulativeProbabilities array or values array are empty, or have unequal length, or when cumulativeProbabilities are not between 0 and 1, or when cumulativeProbabilities are not in ascending order, or when values are not in ascending order, or when the last cumulative probability is not 1.0, or when the first cumulative probability is zero