[R] erf function documentation

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 17 00:00:50 CEST 2004


On Wed, 16 Jun 2004, Prof Brian Ripley wrote:

Aargh don't press keys this late in the day or I'll get the wrong ones.

According to Abramowitz and Stegun section 7.1, 
 
erf z = \frac{2}{\sqrt{pi}} \int^z_0 e^_{-t^2} dt
 
Now pnorm(x) = \frac{1}{sqrt{2\pi}} \int^x_{-\infty} e^_{-u^2/2} du
 
so pnorm(x) - 1/2 = \frac{1}{sqrt{2\pi}} \int^x_0 e^_{-u^2/2} du
 
Now substitute t = u/sqrt{2}

pnorm(x) - 1/2 = \frac{1}{sqrt{2\pi}} \int^{x/\sqrt{2}}_0 e^_{-t^2} dt\sqrt{2}

so pnorm(x) - 1/2 = 1/2 erf(x/\sqrt{2}) or erf(z) = 2 pnorm(x\sqrt{2}) - 1

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list