Package jline.lang.processes
Class DiscreteSampler
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class DiscreteSampler extends DiscreteDistribution
A class for discrete distributions specified from the probability mass function
-
-
Constructor Summary
Constructors Constructor Description DiscreteSampler(Matrix p)DiscreteSampler(Matrix p, Matrix x)Constructs a discrete distribution from a finite probability vector p at the points specified in vector x
-
Method Summary
Modifier and Type Method Description static voidmain(Array<String> args)doubleevalCDF(double t)Evaluates the cumulative distribution function (CDF) at the given point. List<Double>evalPMF()MatrixevalPMF(List<Double> t)doublegetMean()Computes the distribution mean doublegetSCV()Computes the distribution squared coefficient of variation (SCV = variance/mean^2) doublegetSkewness()Gets the skewness of this distribution. booleanisDisabled()Checks if this is a disabled distribution. doublesample()Array<double>sample(int n)Generates random samples from this distribution using default random generator. Array<double>sample(int n, Random random)Generates random samples from this distribution using the specified random generator. -
Methods inherited from class jline.lang.processes.DiscreteDistribution
evalLST, evalPMF, evalPMF -
Methods inherited from class jline.lang.processes.Distribution
evalProbInterval, getName, getNumParams, getParam, getRate, getSupport, getVar, isContinuous, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, 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
-
-
Method Detail
-
evalCDF
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
-
getMean
double getMean()
Computes the distribution mean
- Returns:
- the mean of the distribution
-
getSCV
double getSCV()
Computes the distribution squared coefficient of variation (SCV = variance/mean^2)
-
getSkewness
double getSkewness()
Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.
- Returns:
the skewness value
-
isDisabled
boolean isDisabled()
Checks if this is a disabled distribution.
- Returns:
true if this is a disabled distribution, false otherwise
-
sample
double sample()
-
sample
Array<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
-
-
-
-