Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

erf

Error Function, and variants


Description

Computes the error function, or its inverse, based on the normal distribution. Also computes the complement of the error function, or its inverse,

Usage

erf(x, inverse = FALSE)
erfc(x, inverse = FALSE)

Arguments

x

Numeric.

inverse

Logical. Of length 1.

Details

Erf(x) is defined as

Erf(x) = (2/sqrt(pi)) int_0^x exp(-t^2) dt

so that it is closely related to pnorm. The inverse function is defined for x in (-1,1).

Value

Returns the value of the function evaluated at x.

Note

Some authors omit the term 2/sqrt(pi) from the definition of Erf(x). Although defined for complex arguments, this function only works for real arguments.

The complementary error function erfc(x) is defined as 1-erf(x), and is implemented by erfc. Its inverse function is defined for x in (0,2).

Author(s)

T. W. Yee

References

Abramowitz, M. and Stegun, I. A. (1972). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, New York: Dover Publications Inc.

See Also

Examples

## Not run: 
curve(erf,   -3, 3, col = "orange", ylab = "", las = 1)
curve(pnorm, -3, 3, add = TRUE, col = "blue", lty = "dotted", lwd = 2)
abline(v = 0, h = 0, lty = "dashed")
legend("topleft", c("erf(x)", "pnorm(x)"), col = c("orange", "blue"),
       lty = c("solid", "dotted"), lwd = 1:2) 
## End(Not run)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.