/// <summary> /// Return P(test_statistic <= p), which is the quantile of p for a random variable with normal distribution N~(mu, sigma) /// </summary> /// <param name="p">The cumulative distribution function value</param> /// <param name="mu">The mean of the normal distribution</param> /// <param name="sigma">The standard deviation of the normal distribution</param> /// <returns></returns> public static double GetQuantile(double p, double mu, double sigma) { return(mu + sigma * Constants.Sqrt2 * InverseErrorFunction.GetInvErf(2 * p - 1)); }
/// <summary> /// Return P(test_statistic <= p), which is the lower tail quantile of p for a random variable with normal distribution N~(0, 1) /// This is the alternative implementation of GetQuatile /// </summary> /// <param name="p">The cumulative distribution function value</param> /// <returns></returns> public static double GetQuantile2(double p) { return(Constants.Sqrt2 * InverseErrorFunction.GetInvErf(2 * p - 1)); }