Class EmpiricalCDF

java.lang.Object
jline.lang.processes.Distribution
jline.lang.processes.EmpiricalCDF
All Implemented Interfaces:
Serializable, Copyable

public class EmpiricalCDF extends Distribution
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 Details

    • data

      protected Matrix data
      Rows (F_i, x_i), sorted by F then x.
  • Constructor Details

    • EmpiricalCDF

      public EmpiricalCDF(Matrix xdata)
      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

      public EmpiricalCDF(Matrix cdfdata, Matrix xdata)
      Creates an EmpiricalCDF with separate CDF and value data.
      Parameters:
      cdfdata - the CDF values F, nondecreasing in [0,1] and ending at 1
      xdata - the corresponding points x
  • Method Details

    • sample

      public double[] sample(int n, Random random)
      Description copied from class: Distribution
      Generates random samples from this distribution using the specified random generator.
      Specified by:
      sample in class Distribution
      Parameters:
      n - the number of samples to generate
      random - the random number generator to use
      Returns:
      array of random samples
    • evalCDF

      public double evalCDF(double t)
      Description copied from class: Distribution
      Evaluates the cumulative distribution function (CDF) at the given point.
      Specified by:
      evalCDF in class Distribution
      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: Distribution
      Gets the mean (expected value) of this distribution.
      Specified by:
      getMean in class Distribution
      Returns:
      the mean value
    • getSCV

      public double getSCV()
      Description copied from class: Distribution
      Gets the squared coefficient of variation (SCV) of this distribution. SCV = Var(X) / E[X]^2.
      Specified by:
      getSCV in class Distribution
      Returns:
      the squared coefficient of variation
    • getSkewness

      public double getSkewness()
      Description copied from class: Distribution
      Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.
      Specified by:
      getSkewness in class Distribution
      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 (MATLAB EmpiricalCDF.getMoments).
    • evalLST

      public double evalLST(double s)
      Laplace-Stieltjes transform under the same midpoint rule, including the F_1 atom.
      Specified by:
      evalLST in class Distribution
      Parameters:
      s - the Laplace domain variable
      Returns:
      the LST value at s
    • getData

      public Matrix getData()