java.lang.Object
net.finmath.functions.NonCentralChiSquaredDistribution
Implementation of the cumulative distribution function of the non-central Χ2 distribution.
The implementation is that of Ding's algorithm, splitting the sum since the first term
of the sum is not the largest one (and may be zero).
The algorithm uses Kahan summation for the sums and limits the calculation time to avoid infinity loops.
The method is currently intended to be used as a benchmark in unit tests only.
Note: The implementation currently does not use an alternative algorithm
in cases of high non-centrality, like Benton and Krishnamoorthy. Since the number
of summation is limited, the method may be inaccurate for high non-centrality.
- Author:
- Christian Fries, Ralph Rudd
-
Constructor Summary
ConstructorsConstructorDescriptionNonCentralChiSquaredDistribution(double degreesOfFreedom, double nonCentrality)
Create non-central Χ2 distribution (non-central chi-squared distribution). -
Method Summary
Modifier and TypeMethodDescriptiondouble
cumulativeDistribution(double x)
Cumulative distribution function of the non-central Χ2 distributiondouble
double
-
Constructor Details
-
NonCentralChiSquaredDistribution
public NonCentralChiSquaredDistribution(double degreesOfFreedom, double nonCentrality)Create non-central Χ2 distribution (non-central chi-squared distribution).- Parameters:
degreesOfFreedom
- The number of degrees of freedom, positivenonCentrality
- The non-centrality parameter, not negative
-
-
Method Details
-
cumulativeDistribution
public double cumulativeDistribution(double x)Cumulative distribution function of the non-central Χ2 distribution- Parameters:
x
- A sample point- Returns:
- The probability of X being below x, given that X is non-central Χ2 distributed
-
getDegreesOfFreedom
public double getDegreesOfFreedom()- Returns:
- The number of degrees of freedom
-
getNonCentrality
public double getNonCentrality()- Returns:
- The non-centrality parameter
-