erf {VGAM}R Documentation

Error Function

Description

Computes the error function based on the normal distribution.

Usage

erf(x)

Arguments

x Numeric.

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.

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.

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

pnorm.

Examples

## Not run: 
x = seq(-3, 3, len=200)
plot(x, erf(x), type="l", col="red", las=1, lwd=2,
     main="red is erf(x), blue is pnorm(x)")
abline(v=0, h=0, lty="dashed", col="black")
lines(x, pnorm(x), col="blue", lty="dotted", lwd=2)
## End(Not run)

[Package VGAM version 0.7-7 Index]