Class Probability
java.lang.Object
utils.Probability
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]cdfToPMF(double[] CDF) Converts a CDF P(X ≤ t) to the respective distribution's PMF P(X = t).static double[]discreteUniform(int lower, int upper, boolean cumulative) static doubleequalTo(double[] pmf, int lowerbound, int x) static doubleequalToFromCDF(double[] CDF, int lowerbound, int x) static doubleequalToFromSurvival(double[] survival, int lowerbound, int x) static doublegreaterOrEqual(double[] survival, int lowerbound, int x) static doublegreaterOrEqualFromCDF(double[] CDF, int lowerbound, int x) static doublelesserOrEqual(double[] CDF, int lowerbound, int x) static doublelesserOrEqualFromSurvival(double[] survival, int lowerbound, int x) static double[]minOrMaxDistribution(double[][] CDFs, int[] lowerbounds, int lower, int upper, boolean cumulative) Computes the distribution resulting from taking the maximum or minimum of multiple random variables.static double[]survivalToPMF(double[] survival) Converts a Survival function P(X ≥ t) to the respective distribution's PMF P(X = t).static double[]toCDF(double[] survival) Converts a Survival function P(X ≥ t) to the respective distribution's CDF P(X ≤ t).static double[]toPMF(double[] distribution, boolean cumulative) Converts a CDF/Survival Function to PMF based on thecumulativeflag.static double[]toSurvival(double[] cdf) Converts a CDF P(X ≤ t) to the respective distribution's Survival Function P(X ≥ t).
-
Constructor Details
-
Probability
public Probability()
-
-
Method Details
-
greaterOrEqual
public static double greaterOrEqual(double[] survival, int lowerbound, int x) -
greaterOrEqualFromCDF
public static double greaterOrEqualFromCDF(double[] CDF, int lowerbound, int x) -
lesserOrEqual
public static double lesserOrEqual(double[] CDF, int lowerbound, int x) -
lesserOrEqualFromSurvival
public static double lesserOrEqualFromSurvival(double[] survival, int lowerbound, int x) -
equalTo
public static double equalTo(double[] pmf, int lowerbound, int x) -
equalToFromCDF
public static double equalToFromCDF(double[] CDF, int lowerbound, int x) -
equalToFromSurvival
public static double equalToFromSurvival(double[] survival, int lowerbound, int x) -
toSurvival
public static double[] toSurvival(double[] cdf) Converts a CDF P(X ≤ t) to the respective distribution's Survival Function P(X ≥ t).Assumes that the given array spans the entire domain of the distribution.
- Parameters:
cdf- the Cumulative Distribution Function (CDF)- Returns:
- the Survival Function
-
toCDF
public static double[] toCDF(double[] survival) Converts a Survival function P(X ≥ t) to the respective distribution's CDF P(X ≤ t).Assumes that the given array spans the entire domain of the distribution.
- Parameters:
survival- the Survival Function- Returns:
- the Cumulative Distribution Function (CDF)
-
cdfToPMF
public static double[] cdfToPMF(double[] CDF) Converts a CDF P(X ≤ t) to the respective distribution's PMF P(X = t).Assumes that the given array spans the entire domain of the distribution.
- Parameters:
CDF- the Cumulative Distribution Function (CDF)- Returns:
- the Probability Mass Function (PMF)
-
survivalToPMF
public static double[] survivalToPMF(double[] survival) Converts a Survival function P(X ≥ t) to the respective distribution's PMF P(X = t).Assumes that the given array spans the entire domain of the distribution.
- Parameters:
survival- the Survival Function- Returns:
- the Probability Mass Function (PMF)
-
toPMF
public static double[] toPMF(double[] distribution, boolean cumulative) Converts a CDF/Survival Function to PMF based on thecumulativeflag.- Parameters:
distribution- The distribution (CDF ifcumulative = true, Survival Function ifcumulative = false)cumulative- Whether the input is cumulative (true: CDF) or subtractive (false: Survival Function).- Returns:
- the Probability Mass Function (PMF)
-
discreteUniform
public static double[] discreteUniform(int lower, int upper, boolean cumulative) - Parameters:
lower- inclusive lower bound of the intervalupper- inclusive upper bound of the intervalcumulative- whether to return the CDF of the interval (cumulative = true) or the Survival Function of the interval (cumulative = false).- Returns:
- the discrete CDF or Survival Function of a uniform distribution spanning the given lower and upper bounds
-
minOrMaxDistribution
public static double[] minOrMaxDistribution(double[][] CDFs, int[] lowerbounds, int lower, int upper, boolean cumulative) Computes the distribution resulting from taking the maximum or minimum of multiple random variables.- Parameters:
CDFs- The CDFs or Survival Functions of the distributions to be combinedlowerbounds- lower bounds of each of the distributions provided. The upper bound is encoded in the lengths of the arrays.lower- lower bound of the resulting function (maximum lowerbound of the lowerbounds of the CDFs)upper- upper bound of the resulting function (maximum upperbound of the upperbounds of the CDFs)cumulative-trueif the given functions are cumulative (CDF) andfalseif the given functions are subtractive (Survival Function).- Returns:
- The combined CDF or Survival Function of the given distributions, representing the distribution of the
maximum (
cumulative = true) or minimum (cumulative = false) of the random variables given byCDFsandlowerbounds
-