Class Uniform

    • Constructor Detail

      • Uniform

        public Uniform()
        Constructs a uniform distribution over the range (0,1)
      • Uniform

        public Uniform​(double[] parameters)
        Constructs a uniform distribution with lower limit = parameters[0], upper limit = parameters[1]
        Parameters:
        parameters - The array of parameters
      • Uniform

        public Uniform​(double lowerLimit,
                       double upperLimit)
        Constructs a uniform distribution over the provided range
        Parameters:
        lowerLimit - limit of the distribution
        upperLimit - limit of the distribution
      • Uniform

        public Uniform​(double lowerLimit,
                       double upperLimit,
                       java.lang.String name)
        Constructs a uniform distribution over the provided range
        Parameters:
        lowerLimit - limit of the distribution
        upperLimit - limit of the distribution
        name - an optional name/label
    • Method Detail

      • getMinimum

        public final double getMinimum()
        Gets the lower limit for the distribution
        Returns:
        The lower limit
      • getMaximum

        public final double getMaximum()
        Gets the upper limit of the distribution
        Returns:
        The upper limit
      • setParameters

        public final void setParameters​(double min,
                                        double max)
        Sets the minimum and maximum value of the distribution throws IllegalArgumentException when if min >= max
        Parameters:
        min - The minimum value of the distribution
        max - The maximum value of the distribution
      • setRange

        public final void setRange​(double min,
                                   double max)
        Sets the range
        Parameters:
        min - The lower limit for the distribution
        max - The upper limit for the distribution
      • getRange

        public final double getRange()
        Returns:
        the range (max - min)
      • 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)
        Description copied from interface: InverseCDFIfc
        Provides the inverse cumulative distribution function for the distribution While closed form solutions for the inverse cdf may not exist, numerical search methods can be used to solve F(X) = U.
        Specified by:
        invCDF in interface InverseCDFIfc
        Parameters:
        prob - The probability to be evaluated for the inverse, p must be [0,1] or an IllegalArgumentException is thrown
        Returns:
        The inverse cdf evaluated at the supplied probability
      • pdf

        public final double pdf​(double x)
        Description copied from interface: PDFIfc
        Returns the f(x) where f represents the probability density function for the distribution. Note this is not a probability.
        Specified by:
        pdf in interface PDFIfc
        Parameters:
        x - a double representing the value to be evaluated
        Returns:
        f(x)
      • 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
      • getMoment3

        public final double getMoment3()
        Returns:
        the 3rd moment
      • getMoment4

        public final double getMoment4()
        Returns:
        the 4th moment
      • 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
      • getKurtosis

        public final double getKurtosis()
        Gets the kurtosis of the distribution www.mathworld.wolfram.com/UniformDistribution.html
        Returns:
        the kurtosis
      • getSkewness

        public final double getSkewness()
        Gets the skewness of the distribution www.mathworld.wolfram.com/UniformDistribution.html
        Returns:
        the skewness
      • 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