Class TruncatedDistribution

    • Field Detail

      • myLowerLimit

        protected double myLowerLimit
      • myUpperLimit

        protected double myUpperLimit
      • myCDFLL

        protected double myCDFLL
      • myCDFUL

        protected double myCDFUL
      • myFofLL

        protected double myFofLL
      • myFofUL

        protected double myFofUL
      • myDeltaFUFL

        protected double myDeltaFUFL
    • Constructor Detail

      • TruncatedDistribution

        public TruncatedDistribution​(DistributionIfc distribution,
                                     double cdfLL,
                                     double cdfUL,
                                     double truncLL,
                                     double truncUL)
        Constructs a truncated distribution based on the provided distribution
        Parameters:
        distribution - the distribution to truncate, must not be null
        cdfLL - The lower limit of the range of support of the distribution
        cdfUL - The upper limit of the range of support of the distribution
        truncLL - The truncated lower limit (if moved in from cdfLL), must be >= cdfLL
        truncUL - The truncated upper limit (if moved in from cdfUL), must be <= cdfUL
      • TruncatedDistribution

        public TruncatedDistribution​(DistributionIfc distribution,
                                     double cdfLL,
                                     double cdfUL,
                                     double truncLL,
                                     double truncUL,
                                     java.lang.String name)
        Constructs a truncated distribution based on the provided distribution
        Parameters:
        distribution - the distribution to truncate, must not be null
        cdfLL - The lower limit of the range of support of the distribution
        cdfUL - The upper limit of the range of support of the distribution
        truncLL - The truncated lower limit (if moved in from cdfLL), must be >= cdfLL
        truncUL - The truncated upper limit (if moved in from cdfUL), must be <= cdfUL
        name - an optional name/label
    • Method Detail

      • setDistribution

        public final void setDistribution​(DistributionIfc distribution,
                                          double cdfLL,
                                          double cdfUL,
                                          double truncLL,
                                          double truncUL)
        Parameters:
        distribution - the distribution to truncate, must not be null
        cdfLL - The lower limit of the range of support of the distribution
        cdfUL - The upper limit of the range of support of the distribution
        truncLL - The truncated lower limit (if moved in from cdfLL), must be >= cdfLL
        truncUL - The truncated upper limit (if moved in from cdfUL), must be <= cdfUL
      • setLimits

        public final void setLimits​(double cdfLL,
                                    double cdfUL,
                                    double truncLL,
                                    double truncUL)
        Parameters:
        cdfLL - The lower limit of the range of support of the distribution
        cdfUL - The upper limit of the range of support of the distribution
        truncLL - The truncated lower limit (if moved in from cdfLL), must be >= cdfLL
        truncUL - The truncated upper limit (if moved in from cdfUL), must be <= cdfUL
      • setParameters

        public final void setParameters​(double[] parameters)
        Sets the parameters of the truncated distribution cdfLL = parameter[0] cdfUL = parameters[1] truncLL = parameters[2] truncUL = parameters[3]

        any other values in the array should be interpreted as the parameters for the underlying distribution

        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        parameters - an array of doubles representing the parameters
      • getParameters

        public final double[] getParameters()
        Get the parameters for the truncated distribution

        cdfLL = parameter[0] cdfUL = parameters[1] truncLL = parameters[2] truncUL = parameters[3]

        any other values in the array should be interpreted as the parameters for the underlying distribution

        Specified by:
        getParameters in interface ParametersIfc
        Returns:
        Returns an array of the parameters
      • getCDFLowerLimit

        public final double getCDFLowerLimit()
        The CDF's original lower limit
        Returns:
        CDF's original lower limit
      • getCDFUpperLimit

        public final double getCDFUpperLimit()
        The CDF's original upper limit
        Returns:
        CDF's original upper limit
      • getTruncatedLowerLimit

        public final double getTruncatedLowerLimit()
        The lower limit for the truncated distribution
        Returns:
        lower limit for the truncated distribution
      • getTruncatedUpperLimit

        public final double getTruncatedUpperLimit()
        The upper limit for the trunctated distribution
        Returns:
        upper limit for the trunctated distribution
      • 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
      • 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
      • 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