Class Distribution

    • Field Detail

      • myId

        protected int myId
        The id of this object
      • myName

        protected java.lang.String myName
        Holds the name of the name of the object for the IdentityIfc
    • Constructor Detail

      • Distribution

        public Distribution()
        Constructs a probability distribution
      • Distribution

        public Distribution​(java.lang.String name)
        Constructs a probability distribution
        Parameters:
        name - a String name @returns a valid Distribution
    • Method Detail

      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface GetNameIfc
        Returns:
        the assigned name
      • setName

        public final void setName​(java.lang.String str)
        Sets the name
        Parameters:
        str - The name as a string.
      • getId

        public final int getId()
        Specified by:
        getId in interface IdentityIfc
        Returns:
        a number identifier
      • setId

        protected final void setId()
      • getControls

        public Controls getControls()
        Description copied from interface: ControllableIfc
        Returns a valid instance of Controls that can be used with this ControllableIfc or null
        Specified by:
        getControls in interface ControllableIfc
        Returns:
      • setControls

        public void setControls​(Controls controls)
        Description copied from interface: ControllableIfc
        Takes in a valid instance of Controls for this class If controls is null or if it was not created by this class this method should throw an IllegalArgumentException
        Specified by:
        setControls in interface ControllableIfc
      • getStandardDeviation

        public final double getStandardDeviation()
        Description copied from interface: VarianceIfc
        Returns the standard deviation for the probability distribution as the square root of the variance if it exists
        Specified by:
        getStandardDeviation in interface VarianceIfc
        Returns:
        sqrt(getVariance())
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • inverseContinuousCDFViaBisection

        public static double inverseContinuousCDFViaBisection​(ContinuousDistributionIfc cdf,
                                                              double p,
                                                              double ll,
                                                              double ul)
        Computes the inverse CDF by using the bisection method [ll,ul] must contain the desired value. Initial search point is (ll+ul)/2.0 [ll, ul] are defined on the domain of the CDF, i.e. the X values
        Parameters:
        cdf - a reference to the cdf
        p - must be in [0,1]
        ll - lower limit of search range, must be < ul
        ul - upper limit of search range, must be > ll
        Returns:
        the inverse of the CDF evaluated at p
      • inverseContinuousCDFViaBisection

        public static double inverseContinuousCDFViaBisection​(ContinuousDistributionIfc cdf,
                                                              double p,
                                                              double ll,
                                                              double ul,
                                                              double initialX)
        Computes the inverse CDF by using the bisection method [ll,ul] must contain the desired value [ll, ul] are defined on the domain of the CDF, i.e. the x values
        Parameters:
        cdf - a reference to the cdf
        p - must be in [0,1]
        ll - lower limit of search range, must be < ul
        ul - upper limit of search range, must be > ll
        initialX - an initial starting point that must be in [ll,ul]
        Returns:
        the inverse of the CDF evaluated at p
      • inverseDiscreteCDFViaSearchUp

        public static double inverseDiscreteCDFViaSearchUp​(DiscreteDistributionIfc df,
                                                           double p,
                                                           int start)
        Searches starting at the value start until the CDF > p "start" must be the smallest possible value for the range of the CDF as an integer. This requirement is NOT checked Each value is incremented by 1. Thus, the range of possible values for the CDF is assumed to be {start, start + 1, start + 2, etc.}
        Parameters:
        df - a reference to the discrete distribution
        p - the probability to evaluate, must be (0,1)
        start - the initial starting search position
        Returns:
        the found inverse of the CDF found for p