Re: [R] Inverse Error Function

From: Ravi Varadhan <rvaradhan_at_jhmi.edu>
Date: Tue 27 Jun 2006 - 05:46:32 EST


Hi,

You can use the following relation between standard normal probability distribution (\Phi) and error function:

Erf(z) = 2 * \Phi(\sqrt(2) z) - 1

to evaluate invErf(x) in R as follows:

invErf <- function(x) {
# argument x must lie between -1 and 1
qnorm((1 + x) /2) / sqrt(2)
}

For example,
> invErf(0.5)

[1] 0.4769362762

Hope this helps,
Ravi.



Ravi Varadhan, Ph.D.
Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email: rvaradhan@jhmi.edu
Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch [mailto:r-help-
> bounces@stat.math.ethz.ch] On Behalf Of Nathan Dabney
> Sent: Monday, June 26, 2006 3:27 PM
> To: R-help@stat.math.ethz.ch
> Subject: [R] Inverse Error Function
>
> Do any of the R libraries have an implementation of the Inverse Error
> Function (Inverse ERF)?
>
> ref:
> http://mathworld.wolfram.com/InverseErf.html
> http://functions.wolfram.com/GammaBetaErf/InverseErf/
>
> Thanks,
> Nathan
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-
> guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 27 05:54:47 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 27 Jun 2006 - 06:12:51 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.