Please see, also due to Ewart Shaw, http://www.jsoftware.com/jwiki/Essays/Normal_CDF wherein: erf =: (1 H. 1.5)@*: * 2p_0.5&* % ^@:*: n01cdf=: -: @ >: @ erf @ %&(%:2)
Tests show that compared to Phi, n01cdf is - slighly more accurate - faster by a factor of 25 - leaner by a factor of 3 ----- Original Message ----- From: Alistair Tucker <[EMAIL PROTECTED]> Date: Wednesday, November 1, 2006 9:24 am Subject: Re: [Jprogramming] Algorithm for Inverse Normal CDF (Work in Progress) > Hi > It's a great idea to publish some probability logic, and of course > the Gaussian is an obvious place to start - I was actually a > little surprised to find that there was no built-in support for > this most fundamental of distributions. > I note that you are missing a function for the CDF itself - here's > one I made earlier (ref http://www.jstatsoft.org/v11/i04/v11i04.pdf) > > phi =: (%: o.2) %~ [: ^ [: - 2 %~ *: > smoo =: (+/ @ }: @ ]) , ((*: @ [) * (({. % {:) @ }. @ ])) , (2 + > {: @ ]) > Phi_recursion =: (smoo ` ]) @. (({. = +/) @ }: @ ]) > Phi =: 0.5 + phi * {. @ (] (Phi_recursion ^: _) 0 , ] , 3:) " 0 > > Ali > > ----- Original Message ---- > From: Ewart Shaw <[EMAIL PROTECTED]> > To: Programming forum <[email protected]> > Sent: Wednesday, 1 November, 2006 5:00:12 PM > Subject: [Jprogramming] Algorithm for Inverse Normal CDF (Work in > Progress) > > I'm currently rationalising my J code for probability distributions. > Many published algorithms are in FORTRAN, and translating into J is > (at least initially) a compromise between transliteration (which > makes errors easier to spot) and reinterpretation. > > I've put an initial example under the JWiki > -> Code Workshop -> Work in Progress -> EwartShaw/N01CdfInv > > Anyone who needs the inverse Normal CDF (aka 'quantile function' > or 'normal deviates') might find it useful. See the Wiki page > for further comments. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
