|Re: Summary: Normal CDF and quantile function|
Message #3 Posted by Les Wright on 12 May 2012, 10:53 p.m.,
in response to message #2 by Paul Dale
I'm using the incomplete gamma functions for the normal CDF at the moment -- this frees up three pages of flash :-) for a speed penalty in the QF :-(
An inefficiency of using the IGAMMAs repeatedly to compute the the CDF for the QF is that they rely on regularized incomplete gammas, so the regularizing denominator in this case, which never changes from GAMMA(0.5) = sqrt(Pi), is computed afresh every single time. as opposed to being passed to the internal gser and gcf as a precomputed constant. This could be a bit of time suck, as well as a possible source of rounding error.
My own user-code incomplete gammas, left and right, are not regularized, so in computing the normal CDF and upper tail I divide through by sqrt(Pi). Using a gamma function to compute sqrt(Pi) is obviously not efficient.
Of course, these concerns don't apply to the chi-square, where there regularizing denominator varies according to the number of df, and needs to be calculated. But still, if the chi-square CDF or upper tail is computed repeatedly in refining the inverse quantile, does that denominator of GAMMA(df/2), which does not vary, need to be computed anew in each loop?
Just thinking aloud here. The usual speed-space-accuracy tradeoff...
Edited: 13 May 2012, 2:07 a.m.