Dear all, I have the following problem with the uniroot function. I want to find roots for the fucntion "Fp2" which is defined as below.
Fz <- function(z){0.8*pnorm(z)+p1*pnorm(z-u1)+(0.2-p1)*pnorm(z-u2)} Fp <- function(t){(1-Fz(abs(qnorm(1-(t/2)))))+(Fz(-abs(qnorm(1-(t/2)))))} Fp2 <- function(t) {Fp(t)-0.8*t/alpha} th <- uniroot(Fp2, lower =0, upper =1, tol = 0.0001)$root The result is 0 as shown below. > th [1] 0 However, there should be a root between 0.00952 and 0.00955, since the function values are of opposite signs as below. > Fp2(0.00952) [1] 2.264272e-05 > Fp2(0.00955) [1] -0.0003657404 Can any one give me a hand here? Thanks a lot. Hannah [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.