Package jline.lang.processes
Class EmpiricalCDF
java.lang.Object
jline.lang.processes.Distribution
jline.lang.processes.EmpiricalCDF
- All Implemented Interfaces:
Serializable,Copyable
Empirical CDF for a distribution.
The law is the PIECEWISE-LINEAR CDF through the points (x_i, F_i), sorted by F, with an atom of mass F_1 at x_1
when the first point does not start at zero. evalCDF, sample, the moments and the LST all read that one law, which
is the MATLAB EmpiricalCDF reading (midpoint moments over the bins) with the F_1 atom it used to drop.
JAVA ARGUMENT ORDER: the two-argument constructor takes (cdfdata, xdata), i.e. (F, x), the reverse of
MATLAB/Python/C++ EmpiricalCDF(x, F). A swapped call is refused by the F-column checks rather than read.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEmpiricalCDF(Matrix xdata) Creates an EmpiricalCDF from a two-column matrix.EmpiricalCDF(Matrix cdfdata, Matrix xdata) Creates an EmpiricalCDF with separate CDF and value data. -
Method Summary
Modifier and TypeMethodDescriptiondoubleevalCDF(double t) Evaluates the cumulative distribution function (CDF) at the given point.doubleevalLST(double s) Laplace-Stieltjes transform under the same midpoint rule, including the F_1 atom.getData()doublegetMean()Gets the mean (expected value) of this distribution.double[]Raw moments m1..m3 plus SCV and skewness: the F_1 atom at x_1, then each bin's midpoint weighted by its CDF increment (MATLABEmpiricalCDF.getMoments).doublegetSCV()Gets the squared coefficient of variation (SCV) of this distribution.doubleGets the skewness of this distribution.double[]Generates random samples from this distribution using the specified random generator.Methods inherited from class jline.lang.processes.Distribution
evalLST, evalProbInterval, getFeatureName, getName, getNumParams, getNumParams, getParam, getParam, getParams, getRate, getSupport, getVar, hasParam, isContinuous, isDisabled, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, sample, scv, setNumParams, setParam, skewness, support, var, withDefect, withMassAtOrigin
-
Field Details
-
data
Rows (F_i, x_i), sorted by F then x.
-
-
Constructor Details
-
EmpiricalCDF
Creates an EmpiricalCDF from a two-column matrix.- Parameters:
xdata- the data matrix, column 0 the CDF values F and column 1 the points x
-
EmpiricalCDF
Creates an EmpiricalCDF with separate CDF and value data.- Parameters:
cdfdata- the CDF values F, nondecreasing in [0,1] and ending at 1xdata- the corresponding points x
-
-
Method Details
-
sample
Description copied from class:DistributionGenerates random samples from this distribution using the specified random generator.- Specified by:
samplein classDistribution- Parameters:
n- the number of samples to generaterandom- the random number generator to use- Returns:
- array of random samples
-
evalCDF
public double evalCDF(double t) Description copied from class:DistributionEvaluates the cumulative distribution function (CDF) at the given point.- Specified by:
evalCDFin classDistribution- Parameters:
t- the point at which to evaluate the CDF- Returns:
- the CDF value at point t
-
getMean
public double getMean()Description copied from class:DistributionGets the mean (expected value) of this distribution.- Specified by:
getMeanin classDistribution- Returns:
- the mean value
-
getSCV
public double getSCV()Description copied from class:DistributionGets the squared coefficient of variation (SCV) of this distribution. SCV = Var(X) / E[X]^2.- Specified by:
getSCVin classDistribution- Returns:
- the squared coefficient of variation
-
getSkewness
public double getSkewness()Description copied from class:DistributionGets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.- Specified by:
getSkewnessin classDistribution- Returns:
- the skewness value
-
getMoments
public double[] getMoments()Raw moments m1..m3 plus SCV and skewness: the F_1 atom at x_1, then each bin's midpoint weighted by its CDF increment (MATLABEmpiricalCDF.getMoments). -
evalLST
public double evalLST(double s) Laplace-Stieltjes transform under the same midpoint rule, including the F_1 atom.- Specified by:
evalLSTin classDistribution- Parameters:
s- the Laplace domain variable- Returns:
- the LST value at s
-
getData
-