Class Geometric

    • Constructor Detail

      • Geometric

        public Geometric()
        Constructs a Geometric with success probability = 0.5
      • Geometric

        public Geometric​(double[] parameters)
        Constructs a Geometric using the supplied parameters array parameters[0] is probability of success
        Parameters:
        parameters - the parameter array
      • Geometric

        public Geometric​(double prob)
        Constructs a Geometric using the supplied success probability
        Parameters:
        prob - , the probability of success
      • Geometric

        public Geometric​(double prob,
                         java.lang.String name)
        Constructs a Geometric using the supplied success probability and lower range
        Parameters:
        prob - the probability of success
        name - an optional label/name
    • Method Detail

      • setProbabilityOfSuccess

        public final void setProbabilityOfSuccess​(double prob)
        Sets the probability of success
        Parameters:
        prob - the probability of success
      • getProbabilityOfSuccess

        public final double getProbabilityOfSuccess()
        Gets the probability of success
        Returns:
        the probability of success
      • 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
      • setParameters

        public final void setParameters​(double[] parameters)
        Sets the parameters using the supplied array parameters[0] is probability of success parameters[1] is lower range
        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        parameters - the parameter array
      • getParameters

        public final double[] getParameters()
        Gets the parameters as an array parameters[0] is probability of success
        Specified by:
        getParameters in interface ParametersIfc
        Returns:
        Returns an array of the parameters
      • pmf

        public final double pmf​(int x)
        computes the pmf of the distribution f(x) = p(1-p)^(x) for x>=0, 0 otherwise
        Parameters:
        x - the value to evaluate
        Returns:
        the 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 probability
      • cdf

        public final double cdf​(double x)
        computes the cdf of the distribution F(X<=x)
        Specified by:
        cdf in interface CDFIfc
        Parameters:
        x - , must be >= lower limit
        Returns:
        the cumulative probability
      • invCDF

        public final double invCDF​(double prob)
        Gets the inverse cdf for the distribution
        Specified by:
        invCDF in interface InverseCDFIfc
        Parameters:
        prob - Must be in range [0,1)
        Returns:
        The inverse cdf evaluated at the supplied probability
      • canMatchMoments

        public static boolean canMatchMoments​(double... moments)
      • getParametersFromMoments

        public static double[] getParametersFromMoments​(double... moments)
      • createFromMoments

        public static Geometric createFromMoments​(double... moments)
      • firstOrderLossFunction

        public double firstOrderLossFunction​(double x)
        Description copied from interface: FirstOrderLossFunctionIfc
        Computes the first order loss function for the function for given value of x, G1(x) = E[max(X-x,0)]
        Specified by:
        firstOrderLossFunction in interface FirstOrderLossFunctionIfc
        Parameters:
        x - The value to be evaluated
        Returns:
        The loss function value, E[max(X-x,0)]
      • secondOrderLossFunction

        public double secondOrderLossFunction​(double x)
        Description copied from interface: SecondOrderLossFunctionIfc
        Computes the 2nd order loss function for the distribution function for given value of x, G2(x) = (1/2)E[max(X-x,0)*max(X-x-1,0)]
        Specified by:
        secondOrderLossFunction in interface SecondOrderLossFunctionIfc
        Parameters:
        x - The value to be evaluated
        Returns:
        The loss function value, (1/2)E[max(X-x,0)*max(X-x-1,0)]