Class CumulativeStudentDistribution
The Student t-distribution's cumulative distribution function for n degrees of freedom (see mathworld.wolfram.com): F(x) = ½ + ½·sgn(x)·[I(1; n/2, ½) − I(n/(n + x²); n/2, ½)], I(z; a, b) the regularized incomplete beta function.
public sealed class CumulativeStudentDistribution
- Inheritance
-
CumulativeStudentDistribution
- Inherited Members
Remarks
Immutable. QuantLib's formula loses digits in two places, which nanoql computes otherwise
(Divergences/StudentDistributionTests.cs). Where n/(n + x²) exceeds ½, near the centre and everywhere as n
grows, its incomplete beta takes its complement at 1 − n/(n + x²), losing the argument's digits (6.4e-10 relative at
n 1e6 and 4.6e-9 at 1e8, at x 1.5); there nanoql takes I(x²/(n + x²); ½, n/2), the same value by the beta function's
reflection, its argument computed directly. And below the centre, ½ − ½·(1 − I) cancels as F(x) falls, to 0 where
F(x) is below about 1e-16 (at n 30, x −30); there nanoql takes ½·I(n/(n + x²); n/2, ½), or its reflection's
complement, directly. Both routes take Boost's regularised incomplete beta (ibeta, ported for the quantile),
as QuantLib's own loses digits in its log-gamma prefactor as n grows (7.6e-10 at n 1e6 with the complementary
argument alone): within 8e-14 relative of a high-precision evaluation for n from 1 to 1e9. At n 1 below the centre
Boost's complement is its arcsine form on 1 − z, which rounds 1 − z, so there nanoql takes ½·(1 − I(z; ½, ½)), F
lying in [¼, ½]: within 2.9e-14 of the Cauchy distribution's ½ + atan(x)/π, where QuantLib's value is 0.5 at x
−1e-8, 6.4e-9 off. QuantLib's formula above the centre where n/(n + x²) is at most ½, bit for bit.
Constructors
CumulativeStudentDistribution(int)
Initializes a new instance of the CumulativeStudentDistribution class.
public CumulativeStudentDistribution(int n)
Parameters
nintThe degrees of freedom, positive.
Exceptions
- ArgumentOutOfRangeException
nisn't positive.
Methods
Evaluate(double)
The cumulative distribution function.
public double Evaluate(double x)
Parameters
xdoubleThe point.
Returns
- double
F(x).
Exceptions
- NanoQLException
The incomplete beta's continued fraction doesn't converge.