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 TypeMethodDescriptiondoublecumulativeProbability(double x) Calculates the cumulative probability of a given point.doublecumulativeProbability(double v, double v1) Deprecated.This method is deprecated and will be removed in a future release.doubledensity(double v) Calculates the probability density function (PDF) of a given point.doubleReturns the numerical mean of the empirical cumulative distribution function (CDF).doubleReturns the numerical variance of the empirical cumulative distribution function (CDF).doubleReturns the lower bound of the support for the distribution.doubleReturns the upper bound of the support for the distribution.doubleinverseCumulativeProbability(double v) Calculates the inverse cumulative probability of a given point.booleanReturns a boolean indicating whether the support of the distribution is connected or not.booleanDeprecated.This method is deprecated and will be removed in a future release.booleanDeprecated.This method is deprecated and will be removed in a future release.doubleprobability(double v) Calculates the probability mass function (PMF) of a given point.voidreseedRandomGenerator(long l) Reseeds the random number generator used by the empirical cumulative distribution function (CDF).doublesample()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- aListobject
-
-
Method Details
-
cumulativeProbability
public double cumulativeProbability(double x) Calculates the cumulative probability of a given point.- Specified by:
cumulativeProbabilityin 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:
probabilityin 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:
densityin 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:
cumulativeProbabilityin 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:
inverseCumulativeProbabilityin 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:
getNumericalMeanin 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:
getNumericalVariancein 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:
getSupportLowerBoundin 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:
getSupportUpperBoundin 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:
isSupportLowerBoundInclusivein 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:
isSupportUpperBoundInclusivein 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:
isSupportConnectedin 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:
reseedRandomGeneratorin 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:
samplein 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:
samplein 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
-