[R] Inverse Error Function
Ravi Varadhan
rvaradhan at jhmi.edu
Mon Jun 26 21:46:32 CEST 2006
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 at jhmi.edu
Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
--------------------------------------------------------------------------
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-
> bounces at stat.math.ethz.ch] On Behalf Of Nathan Dabney
> Sent: Monday, June 26, 2006 3:27 PM
> To: R-help at 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 at 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
More information about the R-help
mailing list