Package jline.lang.processes
Class Distribution
java.lang.Object
jline.lang.processes.Distribution
- All Implemented Interfaces:
Serializable,Copyable
- Direct Known Subclasses:
ContinuousDistribution,Det,Disabled,DiscreteDistribution,EmpiricalCDF,Immediate,Prior,Replayer
An abstract class of a general distribution
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDistribution(String name, int numParam, Pair<Double, Double> support) Creates a new distribution with the specified characteristics. -
Method Summary
Modifier and TypeMethodDescriptionabstract doubleevalCDF(double t) Evaluates the cumulative distribution function (CDF) at the given point.abstract doubleevalLST(double s) Evaluate the Laplace-Stieltjes Transform at sorg.apache.commons.math3.complex.ComplexevalLST(org.apache.commons.math3.complex.Complex s) Evaluate the Laplace-Stieltjes Transform at a COMPLEX argument.doubleevalProbInterval(double t0, double t1) Evaluates the probability of the distribution falling within the given interval.The registry name this distribution is marked under byNetwork.getUsedLangFeatures().abstract doublegetMean()Gets the mean (expected value) of this distribution.getName()Gets the name of this distribution type.intGets the number of parameters of this distribution, twin of the MATLABgetNumParams(), which reportslength(params).intgetNumParams(int id) Gets the number of parameters for this distribution.getParam(int id) Gets a parameter by its ID.Returns the parameter carrying a given name, twin of reading the MATLABparamscell by itsparamNamefield.Returns every parameter of this distribution, in declaration order.doublegetRate()Gets the rate of this distribution (inverse of mean).abstract doublegetSCV()Gets the squared coefficient of variation (SCV) of this distribution.abstract doubleGets the skewness of this distribution.Gets the support range of this distribution.doublegetVar()Gets the variance of this distribution.booleanhasParam(int id) Tests whether a parameter has been set at the given position, i.e.booleanChecks if this is a continuous distribution.booleanChecks if this is a disabled distribution.booleanChecks if this is a discrete distribution.booleanChecks if this distribution has immediate (zero) service time.booleanCheck if this distribution is Markovian (has a matrix process representation)doublemean()Property alias for getMeanname()Property alias for getNameintnumParams(int id) Property alias for getNumParams(int id)param(int id) Property alias for getParam(int id)doublerate()Property alias for getRatedouble[]sample(int n) Generates random samples from this distribution using default random generator.abstract double[]Generates random samples from this distribution using the specified random generator.doublescv()Property alias for getSCVvoidsetNumParams(int num) Sets the number of parameters for this distribution.voidSets a parameter value for this distribution.doubleskewness()Property alias for getSkewnesssupport()Property alias for getSupportdoublevar()Property alias for getVar
-
Field Details
-
mean
protected double mean -
immediate
protected boolean immediate -
name
-
numParam
protected int numParam -
support
-
params
-
-
Constructor Details
-
Distribution
Creates a new distribution with the specified characteristics.- Parameters:
name- the name of this distribution typenumParam- the number of parameters requiredsupport- the support range [min, max] for this distribution
-
-
Method Details
-
evalCDF
public abstract double evalCDF(double t) Evaluates the cumulative distribution function (CDF) at the given point.- Parameters:
t- the point at which to evaluate the CDF- Returns:
- the CDF value at point t
-
evalProbInterval
public double evalProbInterval(double t0, double t1) Evaluates the probability of the distribution falling within the given interval. Computes P(t0 <= X <= t1) = F(t1) - F(t0).- Parameters:
t0- the lower bound of the intervalt1- the upper bound of the interval- Returns:
- the probability of falling within [t0, t1]
- Throws:
RuntimeException- if t1 < t0
-
getMean
public abstract double getMean()Gets the mean (expected value) of this distribution.- Returns:
- the mean value
-
getName
Gets the name of this distribution type.- Returns:
- the distribution name
-
getFeatureName
The registry name this distribution is marked under byNetwork.getUsedLangFeatures(). Separate fromgetName()because that one also resolves theProcessTypeand drives the JSON wire type: a subclass whose feature name is more specific than its process type -- a Trace, or a two-phase Coxian -- must be able to say so to the feature gate without moving to a different process type. Defaults to getName(), so a distribution that needs no distinction inherits the old behaviour.- Returns:
- the FeatureSet entry naming this distribution
-
getNumParams
public int getNumParams(int id) Gets the number of parameters for this distribution.- Parameters:
id- parameter identifier (currently unused)- Returns:
- the number of parameters
-
getNumParams
public int getNumParams()Gets the number of parameters of this distribution, twin of the MATLABgetNumParams(), which reportslength(params).- Returns:
- the number of parameters
-
getParam
Gets a parameter by its ID.- Parameters:
id- the parameter ID (1-based index)- Returns:
- the named parameter at the specified position
-
getRate
public double getRate()Gets the rate of this distribution (inverse of mean).- Returns:
- the rate value (1/mean)
-
getSCV
public abstract double getSCV()Gets the squared coefficient of variation (SCV) of this distribution. SCV = Var(X) / E[X]^2.- Returns:
- the squared coefficient of variation
-
getSkewness
public abstract double getSkewness()Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.- Returns:
- the skewness value
-
getSupport
Gets the support range of this distribution.- Returns:
- a pair containing [min, max] values where the distribution is defined
-
getVar
public double getVar()Gets the variance of this distribution. Computed as SCV * mean^2.- Returns:
- the variance
-
isContinuous
public boolean isContinuous()Checks if this is a continuous distribution.- Returns:
- true if this is a continuous distribution, false otherwise
-
isDisabled
public boolean isDisabled()Checks if this is a disabled distribution.- Returns:
- true if this is a disabled distribution, false otherwise
-
isDiscrete
public boolean isDiscrete()Checks if this is a discrete distribution.- Returns:
- true if this is a discrete distribution, false otherwise
-
isImmediate
public boolean isImmediate()Checks if this distribution has immediate (zero) service time.- Returns:
- true if the distribution is immediate or has mean < Zero threshold
-
sample
public double[] sample(int n) Generates random samples from this distribution using default random generator.- Parameters:
n- the number of samples to generate- Returns:
- array of random samples
-
sample
Generates random samples from this distribution using the specified random generator.- Parameters:
n- the number of samples to generaterandom- the random number generator to use- Returns:
- array of random samples
-
setNumParams
public void setNumParams(int num) Sets the number of parameters for this distribution.- Parameters:
num- the number of parameters
-
setParam
Sets a parameter value for this distribution.- Parameters:
id- the parameter ID (1-based index)name- the parameter namevalue- the parameter value
-
getParam
Returns the parameter carrying a given name, twin of reading the MATLABparamscell by itsparamNamefield.- Parameters:
name- the parameter name- Returns:
- the parameter, or null when no parameter carries that name
-
hasParam
public boolean hasParam(int id) Tests whether a parameter has been set at the given position, i.e. whether it still holds the placeholder installed by the constructor.- Parameters:
id- the parameter id (1-based)- Returns:
- true when the parameter has been assigned
-
getParams
Returns every parameter of this distribution, in declaration order. The values are the stored objects, so a matrix-valued parameter (a PH representation, a MAP block) is returned as it is held rather than coerced to a scalar.- Returns:
- the parameter list
-
evalLST
public abstract double evalLST(double s) Evaluate the Laplace-Stieltjes Transform at s- Parameters:
s- the Laplace domain variable- Returns:
- the LST value at s
-
evalLST
public org.apache.commons.math3.complex.Complex evalLST(org.apache.commons.math3.complex.Complex s) Evaluate the Laplace-Stieltjes Transform at a COMPLEX argument. A transform is evaluated off the real axis by everything that inverts it or locates its roots: the Abate-Whitt Euler sum walks a vertical line, and the matrix transform int exp(Ut) dF(t) is read off the spectrum of U, which is complex in general. The realevalLST(double)cannot serve either. This default is the Riemann-Stieltjes sum over the law's own CDF with complex exponentials: the weights are true probability increments, so it is a proper measure for ANY law, including one with an atom or with no density at all. Subclasses that own a closed form override it; the phase-type families do so inMarkovian.- Parameters:
s- the Laplace domain variable- Returns:
- the LST value at s
-
isMarkovian
public boolean isMarkovian()Check if this distribution is Markovian (has a matrix process representation)- Returns:
- true if this is a Markovian distribution, false otherwise
-
name
Property alias for getName -
mean
public double mean()Property alias for getMean -
rate
public double rate()Property alias for getRate -
scv
public double scv()Property alias for getSCV -
skewness
public double skewness()Property alias for getSkewness -
var
public double var()Property alias for getVar -
support
Property alias for getSupport -
numParams
public int numParams(int id) Property alias for getNumParams(int id) -
param
Property alias for getParam(int id)
-