Learn R Programming

VGAM (version 0.8-1)

erf: Error Function

Description

Computes the error function based on the normal distribution.

Usage

erf(x)

Arguments

x
Numeric.

Value

  • Returns the value of the function evaluated at x.

Details

$Erf(x)$ is defined as $$Erf(x) = \frac{2}{\sqrt{\pi}} \int_0^x \exp(-t^2) dt$$ so that it is closely related to pnorm.

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

Run this code
curve(erf,   -3, 3, col="red", 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("red", "blue"),
       lty=c("solid", "dotted"), lwd=1:2)

Run the code above in your browser using DataLab