Interface EmpiricalDistribution

  • All Known Implementing Classes:
    EmpiricalDistributionImpl

    public interface EmpiricalDistribution
    Represents an empirical probability distribution -- a probability distribution derived from observed data without making any assumptions about the functional form of the population distribution that the data come from.

    Implementations of this interface maintain data structures, called distribution digests, that describe empirical distributions and support the following operations:

    • loading the distribution from a file of observed data values
    • dividing the input data into "bin ranges" and reporting bin frequency counts (data for histogram)
    • reporting univariate statistics describing the full set of data values as well as the observations within each bin
    • generating random values from the distribution
    Applications can use EmpiricalDistribution implementations to build grouped frequency histograms representing the input data or to generate random values "like" those in the input file -- i.e., the values generated will follow the distribution of the values in the file.

    • Method Detail

      • load

        void load​(double[] dataArray)
        Computes the empirical distribution from the provided array of numbers.
        Parameters:
        dataArray - the data array
      • load

        void load​(java.io.File file)
           throws java.io.IOException
        Computes the empirical distribution from the input file.
        Parameters:
        file - the input file
        Throws:
        java.io.IOException - if an IO error occurs
      • load

        void load​(java.net.URL url)
           throws java.io.IOException
        Computes the empirical distribution using data read from a URL.
        Parameters:
        url - url of the input file
        Throws:
        java.io.IOException - if an IO error occurs
      • getNextValue

        double getNextValue()
                     throws java.lang.IllegalStateException
        Generates a random value from this distribution. Preconditions:
        • the distribution must be loaded before invoking this method
        Returns:
        the random value.
        Throws:
        java.lang.IllegalStateException - if the distribution has not been loaded
      • getSampleStats

        StatisticalSummary getSampleStats()
                                   throws java.lang.IllegalStateException
        Returns a StatisticalSummary describing this distribution. Preconditions:
        • the distribution must be loaded before invoking this method
        Returns:
        the sample statistics
        Throws:
        java.lang.IllegalStateException - if the distribution has not been loaded
      • isLoaded

        boolean isLoaded()
        Property indicating whether or not the distribution has been loaded.
        Returns:
        true if the distribution has been loaded
      • getBinCount

        int getBinCount()
        Returns the number of bins.
        Returns:
        the number of bins
      • getBinStats

        java.util.List<SummaryStatistics> getBinStats()
        Returns a list of SummaryStatistics containing statistics describing the values in each of the bins. The List is indexed on the bin number.
        Returns:
        List of bin statistics
      • getUpperBounds

        double[] getUpperBounds()
        Returns the array of upper bounds for the bins. Bins are:
        [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],..., (upperBounds[binCount-2], upperBounds[binCount-1] = max].
        Returns:
        array of bin upper bounds