diff --git a/src/Numerics/Distributions/SkewedGeneralizedT.cs b/src/Numerics/Distributions/SkewedGeneralizedT.cs index 720cdeec..4fb35041 100644 --- a/src/Numerics/Distributions/SkewedGeneralizedT.cs +++ b/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