---Devon McCormick wrote:
> NB.* erf: error function
> erf =: (*&(%:4p_1)%^@:*:)*[:1 H. 1.5*:  NB. A&S 7.1.21 (right)
> NB.* cnd: cumulative normal distribution
> cnd =: [:-:1:+[:erf%&(%:2)              NB. A&S 26.2.29 (solved for P)
>
> explainFns=: 0 : 0
> [from http://www.jsoftware.com/jwiki/Doc/Articles/Play193 by Eugene
> McDonnell]
> We haven't ended quite yet. Perhaps you remember the article
> by Ewart Shaw
> in Vector 18.4, in which he defined the error function erf using J's
> hypergeometric conjunction:
>
> erf =: (*&(%:4p_1)%^@:*:)*[:1 H. 1.5*:    NB. A&S 7.1.21 (right)
>
> and then defined the cumulative distribution function of the normal
> distribution by:
>
> cnd =: [:-:1:+[:erf%&(%:2)            NB. A&S 26.2.29 (solved for P)
> )

Yes I remember the article but can't find a copy online or offline right now.

That was what made me wonder if it was possible to define the inverse of erf in 
a similar way.

In case you weren't aware, both these definitions are implemented in the 
'distribution.ijs' script in the 'stats/base' addon (replaces 
'~system/packages/stats/statdist.ijs' script):

NB. =========================================================
NB.*normalcdf  v normal distribution (0,1) CDF
NB. normal(0,1) cumulative distribution function
NB. see wiki Essays/Normal_CDF
NB.
NB. the following are equivalent, but normalcdf more accurate:
NB.   normalcdf X
NB.   1 - normalprob 0 1, X
erf=. (1 H. 1.5)@*: * 2p_0.5&* % ^@:*:
normalcdf=: -: @ >: @ erf @ %&(%:2) f.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to