R Inverse Error Function
Contents |
[ author ] Nathan Dabney wrote: >
Error Message In R
Do any of the R libraries have an implementation of the Inverse Error > Function
R Pnorm
(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 > complementary error function https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Don't know of a built-in function, but you can try this: ## if you want the so-called 'error function' ## from ?pnorm erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1 erf.inv <- function(x) qnorm((x + 1)/2)/sqrt(2) erf.inv(1) erf.inv(0) erf.inv(-1) erf.inv(erf(.25)) erf(erf.inv(.25)) erf.inv(.5) HTH, --sundar Previous message: [R] Inverse Error Function Next message: [R] Inverse Error Function Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the R-help mailing list
van der Loo, www.markvanderloo.eu Examples x <-seq(-0.99,0.99,0.01); plot(x,invErf(x),'l'); [Package extremevalues version 2.2 Index]
Arguments x, y vector http://grokbase.com/t/r/r-help/066tkpncyt/r-inverse-error-function of real numbers. z real or complex number; must be a scalar. Details erf and erfinv are the error and inverse error functions. erfc error function and erfcinv are the complementary error function and its inverse. erfcx is the scaled complementary error function. erfz is the complex, erfi the imaginary error function. Value Real or complex r inverse error number(s), the value(s) of the function. Note For the complex error function we used Fortran code from the book S. Zhang & J. Jin “Computation of Special Functions” (Wiley, 1996). Author(s) First version by Hans W Borchers; vectorized version of erfz by Michael Lachmann. See Also pnorm Examples x <- 1.0 erf(x); 2*pnorm(sqrt(2)*x) - 1 # [1] 0.842700792949715 # [1] 0.842700792949715 erfc(x); 1 - erf(x); 2*pnorm(-sqrt(2)*x) # [1] 0.157299207050285 # [1] 0.157299207050285 # [1] 0.157299207050285 erfz(x) # [1] 0.842700792949715 erfi(x) # [1] 1.650425758797543 [Package pracma version 1.9.5 Index]
reply Tweet Search Discussions Search All Groups r-help 2 responses Oldest Nested Sundar Dorai-Raj Don't know of a built-in function, but you can try this: ## if you want the so-called 'error function' ## from ?pnorm erf <- function(x) 2 * pnorm(x * sqrt(2)) - 1 erf.inv <- function(x) qnorm((x + 1)/2)/sqrt(2) erf.inv(1) erf.inv(0) erf.inv(-1) erf.inv(erf(.25)) erf(erf.inv(.25)) erf.inv(.5) HTH, --sundar Sundar Dorai-Raj at Jun 26, 2006 at 7:44 pm ⇧ Nathan Dabney wrote:Do any of the R libraries have an implementation of the Inverse ErrorFunction (Inverse ERF)?ref:http://mathworld.wolfram.com/InverseErf.htmlhttp://functions.wolfram.com/GammaBetaErf/InverseErf/Thanks,Nathan[[alternative HTML version deleted]]______________________________________________R-help at stat.math.ethz.ch mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlDon't know of a built-in function, but you can try this:## if you want the so-called 'error function'## from ?pnormerf <- function(x) 2 * pnorm(x * sqrt(2)) - 1erf.inv <- function(x) qnorm((x + 1)/2)/sqrt(2)erf.inv(1)erf.inv(0)erf.inv(-1)erf.inv(erf(.25))erf(erf.inv(.25))erf.inv(.5)HTH,--sundar reply | permalink Ravi Varadhan 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, [1] 0.4769362762 Hope this helps, Ravi. -------------------------------------------------------------------------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Ravi Varadhan at Jun 26, 2006 at 7:46 pm ⇧ Hi,You can use the following relation between standard normal probabilitydistribution (\Phi) and error function:Erf(z) = 2 * \Phi(\sqrt(2) z) - 1to evaluate invErf(x) in R as follows:invErf <- function(x) {# argument x must lie between -1 and 1qnorm((1 + x) /2) / sqrt(2)}For example,invErf(0.5)[1] 0.4769362762Hope this helps,Ravi.--------------------------------------------------------------------------Ravi Varadhan, Ph.D.Assistant Professor, The Center on Aging and HealthDivision of Geriatric Medicine and Gerontology