Package edu.cmu.tetrad.sem
Class EmpiricalCdf
java.lang.Object
edu.cmu.tetrad.sem.EmpiricalCdf
- All Implemented Interfaces:
org.apache.commons.math3.distribution.RealDistribution
public class EmpiricalCdf
extends Object
implements org.apache.commons.math3.distribution.RealDistribution
Only the cumulativeProbability, density, setShift methods are implemented.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
cumulativeProbability
(double x) Calculates the cumulative probability of a given point.double
cumulativeProbability
(double v, double v1) Deprecated.This method is deprecated and will be removed in a future release.double
density
(double v) Calculates the probability density function (PDF) of a given point.double
Returns the numerical mean of the empirical cumulative distribution function (CDF).double
Returns the numerical variance of the empirical cumulative distribution function (CDF).double
Returns the lower bound of the support for the distribution.double
Returns the upper bound of the support for the distribution.double
inverseCumulativeProbability
(double v) Calculates the inverse cumulative probability of a given point.boolean
Returns a boolean indicating whether the support of the distribution is connected or not.boolean
Deprecated.This method is deprecated and will be removed in a future release.boolean
Deprecated.This method is deprecated and will be removed in a future release.double
probability
(double v) Calculates the probability mass function (PMF) of a given point.void
reseedRandomGenerator
(long l) Reseeds the random number generator used by the empirical cumulative distribution function (CDF).double
sample()
Returns a sample from the empirical cumulative distribution function (CDF).double[]
sample
(int i) Returns a sample from the empirical cumulative distribution function (CDF).
-
Constructor Details
-
EmpiricalCdf
Constructor for EmpiricalCdf.
- Parameters:
data
- aList
object
-
-
Method Details
-
cumulativeProbability
public double cumulativeProbability(double x) Calculates the cumulative probability of a given point.- Specified by:
cumulativeProbability
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
x
- the point at which the cumulative probability is evaluated- Returns:
- the cumulative probability at the given point
-
probability
public double probability(double v) Calculates the probability mass function (PMF) of a given point.- Specified by:
probability
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
v
- the point at which the PMF is evaluated- Returns:
- the probability mass function at the given point
-
density
public double density(double v) Calculates the probability density function (PDF) of a given point.- Specified by:
density
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
v
- the point at which the PDF is evaluated- Returns:
- the probability density function at the given point
-
cumulativeProbability
@Deprecated public double cumulativeProbability(double v, double v1) throws org.apache.commons.math3.exception.NumberIsTooLargeException Deprecated.This method is deprecated and will be removed in a future release.Calculates the cumulative probability of a given point within the range [v, v1].- Specified by:
cumulativeProbability
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
v
- the exclusive lower boundv1
- the inclusive upper bound- Returns:
- the cumulative probability of the given point within the range
- Throws:
org.apache.commons.math3.exception.NumberIsTooLargeException
- if v is greater than v1
-
inverseCumulativeProbability
public double inverseCumulativeProbability(double v) throws org.apache.commons.math3.exception.OutOfRangeException Calculates the inverse cumulative probability of a given point.- Specified by:
inverseCumulativeProbability
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
v
- the cumulative probability- Returns:
- the point at which the inverse cumulative probability is evaluated
- Throws:
org.apache.commons.math3.exception.OutOfRangeException
- if the cumulative probability is out of range
-
getNumericalMean
public double getNumericalMean()Returns the numerical mean of the empirical cumulative distribution function (CDF). The numerical mean is calculated as the average of the data points.- Specified by:
getNumericalMean
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- the numerical mean of the CDF
-
getNumericalVariance
public double getNumericalVariance()Returns the numerical variance of the empirical cumulative distribution function (CDF). The numerical variance is calculated as the average of the squared differences between each data point and the numerical mean.- Specified by:
getNumericalVariance
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- the numerical variance of the CDF
-
getSupportLowerBound
public double getSupportLowerBound()Returns the lower bound of the support for the distribution. The support is the range of values for which the distribution is defined.- Specified by:
getSupportLowerBound
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- the lower bound of the support
-
getSupportUpperBound
public double getSupportUpperBound()Returns the upper bound of the support for the distribution. The support is the range of values for which the distribution is defined.- Specified by:
getSupportUpperBound
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- the upper bound of the support
-
isSupportLowerBoundInclusive
Deprecated.This method is deprecated and will be removed in a future release.Returns a boolean indicating whether the lower bound of the support is inclusive or not.- Specified by:
isSupportLowerBoundInclusive
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- true if the lower bound is inclusive, false otherwise
-
isSupportUpperBoundInclusive
Deprecated.This method is deprecated and will be removed in a future release.Returns a boolean indicating whether the upper bound of the support is inclusive or not.- Specified by:
isSupportUpperBoundInclusive
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- true if the upper bound is inclusive, false otherwise
-
isSupportConnected
public boolean isSupportConnected()Returns a boolean indicating whether the support of the distribution is connected or not.- Specified by:
isSupportConnected
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- true if the support is connected, false otherwise
-
reseedRandomGenerator
public void reseedRandomGenerator(long l) Reseeds the random number generator used by the empirical cumulative distribution function (CDF).- Specified by:
reseedRandomGenerator
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
l
- the new seed value for the random number generator
-
sample
public double sample()Returns a sample from the empirical cumulative distribution function (CDF).- Specified by:
sample
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Returns:
- a sample from the CDF
-
sample
public double[] sample(int i) Returns a sample from the empirical cumulative distribution function (CDF).- Specified by:
sample
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Parameters:
i
- the number of random values to generate- Returns:
- an array of random values sampled from the CDF
-