Class MTP

    • Constructor Detail

      • MTP

        public MTP()
        defaults mixing prob = 0.5, shift = 0.0, rate = 1.0
      • MTP

        public MTP​(double mixProb,
                   double shift,
                   double rate)
        Constructs an MTP with mixing probabilities 1-mixProb and mixProb with shifts of shift and shift+1 with rates equal to rate
        Parameters:
        mixProb - the mixing probability
        shift - the shift
        rate - the rate
      • MTP

        public MTP​(double mixProb,
                   double shift,
                   double rate,
                   java.lang.String name)
        Constructs an MTP using the supplied parameters
        Parameters:
        mixProb - the mixing probability
        shift - the shift
        rate - the rate
        name - an optional name/label
      • MTP

        public MTP​(double[] parameters)
        Constructs an MTP with array of parameters parameters[0] - mixing probability; parameters[1] - shift; parameters[2] - rate;
        Parameters:
        parameters - the parameter array
    • Method Detail

      • newInstance

        public final MTP newInstance()
        Returns a new instance of the random source with the same parameters but an independent generator
        Specified by:
        newInstance in interface NewInstanceIfc
        Specified by:
        newInstance in class Distribution
        Returns:
        a new instance with the same parameters
      • cdf

        public 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
      • getMean

        public 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
      • getParameters

        public double[] getParameters()
        Description copied from interface: ParametersIfc
        Gets the parameters
        Specified by:
        getParameters in interface ParametersIfc
        Returns:
        Returns an array of the parameters
      • getVariance

        public 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
      • invCDF

        public 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
      • setParameters

        public void setParameters​(double[] parameters)
        Description copied from interface: ParametersIfc
        Sets the parameters
        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        parameters - an array of doubles representing the parameters
      • complementaryCDF

        public double complementaryCDF​(double x)
        Description copied from interface: CDFIfc
        Computes the complementary cumulative probability distribution function for given value of x
        Specified by:
        complementaryCDF in interface CDFIfc
        Parameters:
        x - The value to be evaluated
        Returns:
        The probability, 1-P{X<=x}
      • 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)]
      • thirdOrderLossFunction

        public double thirdOrderLossFunction​(double x)
      • setParameters

        public void setParameters​(double rate,
                                  double shift,
                                  double mixProbability)
        Parameters:
        rate - the rate
        shift - the shift
        mixProbability - the mixing probability
      • main

        public static void main​(java.lang.String[] args)