Class ShiftedGeometric

    • Constructor Detail

      • ShiftedGeometric

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

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

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

        public ShiftedGeometric​(double prob,
                                java.lang.String name)
        Constructs a ShiftedGeometric using the supplied success probability
        Parameters:
        prob - the probability of success
        name - an optional name/label
    • 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
        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:
        the parameter array
      • pmf

        public final double pmf​(int x)
        computes the pmf of the distribution f(x) = p(1-p)^(x-1.0)
        Parameters:
        x - the value to evaluate
        Returns:
        the probability at x
      • pmf

        public final double pmf​(double x)
        Description copied from interface: PMFIfc
        Returns the f(x) where f represents the probability mass function for the distribution.
        Specified by:
        pmf in interface PMFIfc
        Parameters:
        x - a double representing the value to be evaluated
        Returns:
        f(x) the P(X=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 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