Browse Source

Use specialzied distributions depending on param values in InvCDF

v4
mikael 7 years ago
committed by Christoph Ruegg
parent
commit
fe0e680f4b
  1. 12
      src/Numerics/Distributions/SkewedGeneralizedT.cs

12
src/Numerics/Distributions/SkewedGeneralizedT.cs

@ -408,6 +408,18 @@ namespace MathNet.Numerics.Distributions
throw new ArgumentException(Resources.InvalidDistributionParameters);
}
// If parameters represent a specialized distribution, then we use that distribution to avoid
// problems with infinite p or q parameters.
var d = FindSpecializedDistribution(location, scale, skew, p, q);
// InverseCumulativeDistribution is not a part of the interface, so resort to type-checking.
if (d != null)
{
if (d is SkewedGeneralizedError sge)
return sge.InverseCumulativeDistribution(pr);
if (d is ContinuousUniform u)
return u.InverseCumulativeDistribution(pr);
}
// Note: Adapted from the R package,
// solving for the inverse of the CDF that uses the inverse of the incomplete beta function or
// incomplete gamma function

Loading…
Cancel
Save