Class DiscreteSampler

  • All Implemented Interfaces:
    java.io.Serializable , jline.lang.Copyable

    
    public class DiscreteSampler
    extends DiscreteDistribution
                        

    A class for discrete distributions specified from the probability mass function

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void main(Array<String> args)
      double evalCDF(double t) Evaluates the cumulative distribution function (CDF) at the given point.
      List<Double> evalPMF()
      Matrix evalPMF(List<Double> t)
      double getMean() Computes the distribution mean
      double getSCV() Computes the distribution squared coefficient of variation (SCV = variance/mean^2)
      double getSkewness() Gets the skewness of this distribution.
      boolean isDisabled() Checks if this is a disabled distribution.
      double sample()
      Array<double> sample(int n) Generates random samples from this distribution using default random generator.
      Array<double> sample(int n, Random random) Generates random samples from this distribution using the specified random generator.
      • Methods inherited from class jline.lang.processes.DiscreteDistribution

        evalLST, evalPMF, evalPMF
      • Methods inherited from class jline.lang.processes.Distribution

        evalProbInterval, getName, getNumParams, getParam, getRate, getSupport, getVar, isContinuous, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, scv, setNumParams, setParam, skewness, support, var
      • Methods inherited from class jline.lang.Copyable

        copy
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DiscreteSampler

        DiscreteSampler(Matrix p)
      • DiscreteSampler

        DiscreteSampler(Matrix p, Matrix x)
        Constructs a discrete distribution from a finite probability vector p at the points specified in vector x
        Parameters:
        p - - the probability of an item
        x - - the value of an item
    • Method Detail

      • evalCDF

         double evalCDF(double t)

        Evaluates the cumulative distribution function (CDF) at the given point.

        Parameters:
        t - the point at which to evaluate the CDF
        Returns:

        the CDF value at point t

      • getMean

         double getMean()

        Computes the distribution mean

        Returns:

        - the mean of the distribution

      • getSCV

         double getSCV()

        Computes the distribution squared coefficient of variation (SCV = variance/mean^2)

      • getSkewness

         double getSkewness()

        Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.

        Returns:

        the skewness value

      • isDisabled

         boolean isDisabled()

        Checks if this is a disabled distribution.

        Returns:

        true if this is a disabled distribution, false otherwise

      • sample

         Array<double> sample(int n)

        Generates random samples from this distribution using default random generator.

        Parameters:
        n - the number of samples to generate
        Returns:

        array of random samples

      • sample

         Array<double> sample(int n, Random random)

        Generates random samples from this distribution using the specified random generator.

        Parameters:
        n - the number of samples to generate
        random - the random number generator to use
        Returns:

        array of random samples