Class Triangular

    • Constructor Summary

      Constructors 
      Constructor Description
      Triangular()
      Constructs a Triangular distribution with min = 0.0, mode = 0.0, and max = 1.0
      Triangular​(double[] parameters)
      Constructs a Triangular distribution with min = parameters[0], mode = parameters[1], max = parameters[2]
      Triangular​(double min, double mode, double max)
      Constructs a Triangular distribution with min, mode, and max
      Triangular​(double min, double mode, double max, java.lang.String name)
      Constructs a Triangular distribution with min, mode, and max
    • Constructor Detail

      • Triangular

        public Triangular()
        Constructs a Triangular distribution with min = 0.0, mode = 0.0, and max = 1.0
      • Triangular

        public Triangular​(double[] parameters)
        Constructs a Triangular distribution with min = parameters[0], mode = parameters[1], max = parameters[2]
        Parameters:
        parameters - The array of parameters
      • Triangular

        public Triangular​(double min,
                          double mode,
                          double max)
        Constructs a Triangular distribution with min, mode, and max
        Parameters:
        min - The minimum value of the distribution
        mode - The mode of the distribution
        max - The maximum value of the distribution
      • Triangular

        public Triangular​(double min,
                          double mode,
                          double max,
                          java.lang.String name)
        Constructs a Triangular distribution with min, mode, and max
        Parameters:
        min - The minimum value of the distribution
        mode - The mode of the distribution
        max - The maximum value of the distribution
        name - an optional label/name
    • Method Detail

      • setParameters

        public final void setParameters​(double min,
                                        double mode,
                                        double max)
        Sets the minimum, most likely and maximum value of the triangular distribution to the private data members myMin, myMode and myMax resp throws IllegalArgumentException when the min >mode, min >= max, mode > max
        Parameters:
        min - The minimum value of the distribution
        mode - The mode of the distribution
        max - The maximum value of the distribution
      • checkParameters

        public static boolean checkParameters​(double[] param)
        Returns true if the parameters are valid for the distribution min = param[0] mode = param[1] max = param[2]
        Parameters:
        param - the parameter array
        Returns:
        true if the parameters are valid
      • getMinimum

        public final double getMinimum()
        Returns:
        the minimum of the distribution
      • getMode

        public final double getMode()
        Returns:
        the mode of the distribution
      • getMaximum

        public final double getMaximum()
        Returns:
        the maximum of the distribution
      • 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
      • 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)
      • 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 p)
        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:
        p - 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
      • getKurtosis

        public final double getKurtosis()
        Gets the kurtosis of the distribution mu4/mu2^2, www.mathworld.wolfram.com/Kurtosis.html www.mathworld.wolfram.com/TriangularDistribution.html
        Returns:
        the kurtosis
      • getSkewness

        public final double getSkewness()
        Gets the skewness of the distribution mu3/mu2^(3/2), www.mathworld.wolfram.com/Skewness.html www.mathworld.wolfram.com/TriangularDistribution.html
        Returns:
        the skewness
      • setParameters

        public void setParameters​(double[] parameters)
        Sets the parameters for the distribution parameters[0] min The minimum value of the distribution parameters[1] mode The mode of the distribution parameters[2] max The maximum value of the distribution
        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        parameters - an array of doubles representing the parameters for the distribution
      • getParameters

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