[R] solving a complicated equation
Andreas Hary
u08adh at hotmail.com
Mon Nov 7 00:05:05 CET 2005
Try something like this:
> g <- function(x) return(p-a*exp(-x^2/2)+b*pnorm(x,0,1,lower.tail=F))
> p <- -0.5
> a <- 1
> b <- 1
> uniroot(g,c(-100,10))
$root
[1] -1.336607
$f.root
[1] 4.738e-06
$iter
[1] 11
$estim.prec
[1] 6.103516e-05
Regards,
Andreas
----- Original Message -----
From: "Cunningham Kerry" <kerryrekky at yahoo.com>
To: <r-help at stat.math.ethz.ch>
Sent: Sunday, November 06, 2005 10:47 PM
Subject: [R] solving a complicated equation
>I want to solve the following equation for x
>
> p=a*exp(-x^2/2)+b*P(Z>x)
>
> where p,a,b are known, Z is a standard normal
> variable. Clearly there is no analytic form for
> P(Z>x).
>
> I am wondering if any expert could direct one easy way
> on this. Thank you.
>
> ______________________________________________
> 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