Class Prior
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class Prior extends Distribution implements Serializable
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);
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Distribution>distributionsprotected Array<double>probabilitiesprotected doublemeanprotected booleanimmediateprotected Stringnameprotected intnumParamprotected Pair<Double, Double>supportprotected List<NamedParam>params
-
Constructor Summary
Constructors Constructor Description Prior(List<Distribution> distributions, Array<double> probabilities)Creates a Prior distribution with specified alternatives and probabilities. Prior(Array<Distribution> distributions, Array<double> probabilities)Convenience constructor for array-based input.
-
Method Summary
Modifier and Type Method Description intgetNumAlternatives()Returns the number of alternative distributions. DistributiongetAlternative(int idx)Returns the distribution at the specified index. doublegetProbability(int idx)Returns the probability of the alternative at the specified index. Array<double>getProbabilities()Returns the array of all probabilities. List<Distribution>getDistributions()Returns the list of all distributions. doublegetMean()Gets the prior-weighted mean (expected mean over alternatives). doublegetSCV()Gets the prior-weighted SCV using law of total variance. doublegetSkewness()Gets the prior-weighted skewness. Array<double>sample(int n, Random random)Generates random samples from the Prior (mixture sampling). doubleevalCDF(double t)Evaluates the mixture CDF at t. doubleevalLST(double s)Evaluates the mixture Laplace-Stieltjes transform. booleanisPrior()Returns true indicating this is a Prior distribution. static booleanisPriorDistribution(Distribution dist)Static method to check if a distribution is a Prior. -
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 -
Methods inherited from class jline.lang.Copyable
copy -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Prior
Prior(List<Distribution> distributions, Array<double> probabilities)
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)
-
Prior
Prior(Array<Distribution> distributions, Array<double> probabilities)
Convenience constructor for array-based input.- Parameters:
distributions- array of alternative Distribution objectsprobabilities- array of probabilities
-
-
Method Detail
-
getNumAlternatives
int getNumAlternatives()
Returns the number of alternative distributions.
- Returns:
number of alternatives
-
getAlternative
Distribution getAlternative(int idx)
Returns the distribution at the specified index.
- Parameters:
idx- 0-based index- Returns:
the distribution at index idx
-
getProbability
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
-
getProbabilities
Array<double> getProbabilities()
Returns the array of all probabilities.
- Returns:
copy of probability array
-
getDistributions
List<Distribution> getDistributions()
Returns the list of all distributions.
- Returns:
list of distributions (unmodifiable view recommended)
-
getMean
double getMean()
Gets the prior-weighted mean (expected mean over alternatives). E[X] = sum_i p_i * E[X_i]
- Returns:
the weighted mean
-
getSCV
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
- Returns:
the weighted SCV
-
getSkewness
double getSkewness()
Gets the prior-weighted skewness. Uses mixture formula with moment calculations.
- Returns:
the weighted skewness
-
sample
Array<double> sample(int n, Random random)
Generates random samples from the Prior (mixture sampling). Each sample is drawn from one of the alternatives selected according to the prior probabilities.
- Parameters:
n- number of samplesrandom- the random number generator- Returns:
array of samples
-
evalCDF
double evalCDF(double t)
Evaluates the mixture CDF at t. F(t) = sum_i p_i * F_i(t)
- Parameters:
t- the point at which to evaluate- Returns:
the CDF value
-
evalLST
double evalLST(double s)
Evaluates the mixture Laplace-Stieltjes transform. L(s) = sum_i p_i * L_i(s)
- Parameters:
s- the transform variable- Returns:
the LST value
-
isPrior
boolean isPrior()
Returns true indicating this is a Prior distribution. Used for detection by Posterior solver.
- Returns:
true
-
isPriorDistribution
static boolean isPriorDistribution(Distribution dist)
Static method to check if a distribution is a Prior.
- Parameters:
dist- the distribution to check- Returns:
true if dist is a Prior
-
-
-
-