[R] erf function documentation

Charles Maner ckjmaner at yahoo.com
Wed Jun 16 23:14:16 CEST 2004


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)'.

Again, I may be incorrect.  If so, kindly let me know.
 But, if I am correct, perhaps the documentation could
be corrected in a subsequent R release.


Thanks,
Charles




More information about the R-help mailing list