Hi Daniel,
Thanks so much for your positive feedback. Unfortunately, I am currently in my medical residency and have not worked with MATLAB for some time. Thus, I am currently unable to help you find a similar fast implementation to calculate the cdf of a Student's t distribution. Sorry and thanks so much for your positive feedback and rating!
Yours,
Misha

Comment only

30 Jul 2014

faster normcdf function
Based on Marsaglia "Evaluating the Normal Distribution", J. of Stat Soft 11, 4 (July 2004).

This function is much faster than Matlab's normcdf, congratulations!
I'm agerly looking for a similar fast implementation to calculate the cdf of a t-student distribution. Any ideas where I can find such faster function?
Thanks!

Thank you very much Dr Hahn for your wonderful comment.
You are correct no error checking is currently done for the sake of speed. In our application of Bayesian clustering if we are computing phi(nan) somewhere then there is indeed something seriously wrong with our code. I agree, a crash may not be the best way to alert a user to such a problem, but at the very least on our application we have not encountered such a case.
I am also quite curious about your speed comment with regards to erfc being just as fast. I cannot vouch for this one hundred percent as it was some time ago but I am fairly sure that, at the time of writing phi, I did find a speed difference between phi and use of erfc as you suggested on my Ubuntu 8.04 amd64 machine. However, as we are computing marginal likelihoods over many cycles (~100,000) of a Gibbs sampler, we are calling this function quite a bit and so even a very small speed increase becomes significant.
Maybe MATLAB has improved their erfc implementation or perhaps you are on a different platform? In any case thank you for your valuable feedback!
Misha

Comment only

07 Oct 2010

faster normcdf function
Based on Marsaglia "Evaluating the Normal Distribution", J. of Stat Soft 11, 4 (July 2004).

It's a nice mex file.
On my machine it's about 4 times faster than normcdf.
However ...
... there is (for the sake of speed) no error checkin: phi(nan) crashes Matlab (at least on my machine).
So I would prefer to use simply 0.5 * erfc(-z ./ sqrt(2)), which is as fast as phi, and much more robust.

Comment only