Package jline.lang.processes
Class Prior
java.lang.Object
jline.lang.processes.Distribution
jline.lang.processes.Prior
- All Implemented Interfaces:
Serializable,Copyable
Prior distribution representing parameter uncertainty over alternative distributions.
Prior represents parameter uncertainty by specifying a discrete set of
alternative distributions with associated probabilities. When used with
setService or setArrival, it causes the Posterior solver to expand the
model into a family of networks, one for each alternative.
This is NOT a mixture distribution - each alternative represents a
separate model realization with its associated prior probability.
Example usage:
List<Distribution> dists = Arrays.asList(new Exp(1.0), new Exp(2.0), new Erlang(1.5, 2));
double[] probs = {0.4, 0.35, 0.25};
Prior prior = new Prior(dists, probs);
queue.setService(jobclass, prior);
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Distribution> Cell array of alternative distributionsprotected double[]Vector of prior probabilities (must sum to 1) -
Constructor Summary
ConstructorsConstructorDescriptionPrior(List<Distribution> distributions, double[] probabilities) Creates a Prior distribution with specified alternatives and probabilities.Prior(Distribution[] distributions, double[] probabilities) Convenience constructor for array-based input. -
Method Summary
Modifier and TypeMethodDescriptiondoubleevalCDF(double t) Evaluates the mixture CDF at t.doubleevalLST(double s) Evaluates the mixture Laplace-Stieltjes transform.getAlternative(int idx) Returns the distribution at the specified index.Returns the list of all distributions.doublegetMean()Gets the prior-weighted mean (expected mean over alternatives).intReturns the number of alternative distributions.double[]Returns the array of all probabilities.doublegetProbability(int idx) Returns the probability of the alternative at the specified index.doublegetSCV()Gets the prior-weighted SCV using law of total variance.doubleGets the prior-weighted skewness.booleanisPrior()Returns true indicating this is a Prior distribution.static booleanStatic method to check if a distribution is a Prior.double[]Generates random samples from the Prior (mixture sampling).Methods inherited from class jline.lang.processes.Distribution
evalProbInterval, getName, getNumParams, getParam, getRate, getSupport, getVar, isContinuous, isDisabled, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, sample, scv, setNumParams, setParam, skewness, support, var
-
Field Details
-
distributions
Cell array of alternative distributions -
probabilities
protected double[] probabilitiesVector of prior probabilities (must sum to 1)
-
-
Constructor Details
-
Prior
Creates a Prior distribution with specified alternatives and probabilities.- Parameters:
distributions- list of alternative Distribution objectsprobabilities- array of probabilities (must sum to 1 and be non-negative)- Throws:
RuntimeException- if validation fails
-
Prior
Convenience constructor for array-based input.- Parameters:
distributions- array of alternative Distribution objectsprobabilities- array of probabilities
-
-
Method Details
-
getNumAlternatives
public int getNumAlternatives()Returns the number of alternative distributions.- Returns:
- number of alternatives
-
getAlternative
Returns the distribution at the specified index.- Parameters:
idx- 0-based index- Returns:
- the distribution at index idx
- Throws:
IndexOutOfBoundsException- if idx is out of bounds
-
getProbability
public double getProbability(int idx) Returns the probability of the alternative at the specified index.- Parameters:
idx- 0-based index- Returns:
- the probability at index idx
- Throws:
IndexOutOfBoundsException- if idx is out of bounds
-
getProbabilities
public double[] getProbabilities()Returns the array of all probabilities.- Returns:
- copy of probability array
-
getDistributions
Returns the list of all distributions.- Returns:
- list of distributions (unmodifiable view recommended)
-
getMean
public double getMean()Gets the prior-weighted mean (expected mean over alternatives). E[X] = sum_i p_i * E[X_i]- Specified by:
getMeanin classDistribution- Returns:
- the weighted mean
-
getSCV
public double getSCV()Gets the prior-weighted SCV using law of total variance. Var(X) = E[Var(X|D)] + Var(E[X|D]) SCV = Var(X) / E[X]^2- Specified by:
getSCVin classDistribution- Returns:
- the weighted SCV
-
getSkewness
public double getSkewness()Gets the prior-weighted skewness. Uses mixture formula with moment calculations.- Specified by:
getSkewnessin classDistribution- Returns:
- the weighted skewness
-
sample
Generates random samples from the Prior (mixture sampling). Each sample is drawn from one of the alternatives selected according to the prior probabilities.- Specified by:
samplein classDistribution- Parameters:
n- number of samplesrandom- the random number generator- Returns:
- array of samples
-
evalCDF
public double evalCDF(double t) Evaluates the mixture CDF at t. F(t) = sum_i p_i * F_i(t)- Specified by:
evalCDFin classDistribution- Parameters:
t- the point at which to evaluate- Returns:
- the CDF value
-
evalLST
public double evalLST(double s) Evaluates the mixture Laplace-Stieltjes transform. L(s) = sum_i p_i * L_i(s)- Specified by:
evalLSTin classDistribution- Parameters:
s- the transform variable- Returns:
- the LST value
-
isPrior
public boolean isPrior()Returns true indicating this is a Prior distribution. Used for detection by Posterior solver.- Returns:
- true
-
isPriorDistribution
Static method to check if a distribution is a Prior.- Parameters:
dist- the distribution to check- Returns:
- true if dist is a Prior
-