示例#1
0
        //  Now comes a whole lot of code just to invert the Gamma CDF, which is a major pain!

        // The probit function is the inverse CDF of the standard normal distribution
        // Since Gamma becomes approximately normal for large shape parameters, this is useful
        // in that regime

        private static double ApproximateProbit(double P)
        {
            if (P < 0.1)
            {
                return(-Global.SqrtTwo * AdvancedMath.ApproximateInverseErfc(2.0 * P));
            }
            else if (P < 0.9)
            {
                return(Global.SqrtTwo * AdvancedMath.ApproximateInverseErf(2.0 * P - 1.0));
            }
            else
            {
                return(Global.SqrtTwo * AdvancedMath.ApproximateInverseErfc(2.0 * (1.0 - P)));
            }
        }