Class DUniform

    • Constructor Summary

      Constructors 
      Constructor Description
      DUniform()
      Constructs a discrete uniform over the range {0,1}
      DUniform​(double[] parameters)
      Constructs a discrete uniform where parameter[0] is the lower slimit and parameter[1] is the upper limit of the range.
      DUniform​(int minimum, int maximum)
      Constructs a discrete uniform over the supplied range the lower limit must be < upper limit
      DUniform​(int minimum, int maximum, java.lang.String name)
      Constructs a discrete uniform over the supplied range the lower limit must be < upper limit
    • Constructor Detail

      • DUniform

        public DUniform()
        Constructs a discrete uniform over the range {0,1}
      • DUniform

        public DUniform​(double[] parameters)
        Constructs a discrete uniform where parameter[0] is the lower slimit and parameter[1] is the upper limit of the range. the lower limit must be < upper limit
        Parameters:
        parameters - A array containing the lower limit and upper limit
      • DUniform

        public DUniform​(int minimum,
                        int maximum)
        Constructs a discrete uniform over the supplied range the lower limit must be < upper limit
        Parameters:
        minimum - The lower limit of the range
        maximum - The upper limit of the range
      • DUniform

        public DUniform​(int minimum,
                        int maximum,
                        java.lang.String name)
        Constructs a discrete uniform over the supplied range the lower limit must be < upper limit
        Parameters:
        minimum - The lower limit of the range
        maximum - The upper limit of the range
        name - an optional name/label
    • Method Detail

      • getMinimum

        public final int getMinimum()
        Gets the distribution's lower limit
        Returns:
        The lower limit
      • getMaximum

        public final int getMaximum()
        Gets the distribution's upper limit
        Returns:
        The upper limit
      • setRange

        public final void setRange​(int minimum,
                                   int maximum)
        Sets the range for the distribution the lower limit must be < upper limit
        Parameters:
        minimum - The lower limit for the range
        maximum - The upper limit for the range
      • getRange

        public final int getRange()
        The discrete maximum - minimum + 1
        Returns:
        the returned range
      • cdf

        public final double cdf​(double x)
        Description copied from interface: CDFIfc
        Returns the F(x) = Pr{X <= x} where F represents the cumulative distribution function
        Specified by:
        cdf in interface CDFIfc
        Parameters:
        x - a double representing the upper limit
        Returns:
        a double representing the probability
      • invCDF

        public final double invCDF​(double prob)
        Provides the inverse cumulative distribution function for the distribution
        Specified by:
        invCDF in interface InverseCDFIfc
        Parameters:
        prob - The probability to be evaluated for the inverse, prob must be [0,1] or an IllegalArgumentException is thrown
        Returns:
        The inverse cdf evaluated at the supplied probability
      • pmf

        public final double pmf​(double x)
        If x is not and integer value, then the probability must be zero otherwise pmf(int x) is used to determine the probability
        Specified by:
        pmf in interface PMFIfc
        Parameters:
        x - the value to evaluate
        Returns:
        the associated probability
      • getMean

        public final double getMean()
        Description copied from interface: MeanIfc
        Returns the mean or expected value of a distribution
        Specified by:
        getMean in interface MeanIfc
        Returns:
        double the mean or expected value for the distribution
      • getVariance

        public final double getVariance()
        Description copied from interface: VarianceIfc
        Returns the variance of the distribution if defined
        Specified by:
        getVariance in interface VarianceIfc
        Returns:
        double the variance of the random variable
      • pmf

        public final double pmf​(int x)
        Returns the probability associated with x
        Parameters:
        x - the value to evaluate
        Returns:
        the associated probability
      • setParameters

        public final void setParameters​(double[] parameters)
        Sets the parameters for the distribution where parameters[0] is the lowerlimit and parameters[1] is the upper limit of the range. the lower limit must be < upper limit
        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        parameters - an array of doubles representing the parameters for the distribution
      • getParameters

        public final double[] getParameters()
        Gets the parameters for the distribution
        Specified by:
        getParameters in interface ParametersIfc
        Returns:
        Returns an array of the parameters for the distribution