On Wed, 16 Jun 2004 14:14:16 -0700 (PDT), Charles Maner
<[EMAIL PROTECTED]> wrote:

>Hi all.  I may be wrong, (and often am), but in trying
>to determine how to calculate the erf function, the
>documentation for 'pnorm' states:
>
>## if you want the so-called 'error function'
>erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1
>## and the so-called 'complementary error function'
>erfc <- function(x) 2 * pnorm(x * sqrt(2),
>lower=FALSE)
>
>Should, instead, it read:
>## if you want the so-called 'error function'
>erf <- function(x) 2 * pnorm(x / sqrt(2)) - 1
>## and the so-called 'complementary error function'
>erfc <- function(x) 2 * pnorm(x / sqrt(2),
>lower=FALSE)
>
>I've looked at a couple references and they all show
>that 'x' should be divided by, not multiplied by,
>'sqrt(2)'.

The "Mathworld" web page at 

http://mathworld.wolfram.com/NormalDistributionFunction.html

shows

pnorm(x) - 1/2 = (1/2)*erf(x/sqrt(2))

(note that their Phi(x) = pnorm(x) - 1/2).  This agrees with the pnorm
documentation once you rearrange things.

Duncan Murdoch

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to