On 18-Jun-07 16:01:03, livia wrote: > > Hi, I would like to minimize the value of x1-x2, x2 is a fixed > value of 0.01, > x1 is the quantile of normal distribution (0.0032,x) with > probability of 0.7, and the changing value should be x. > Initial value for x is 0.0207.
I'm a bit puzzled by the question. If I understand it right, we can ignore x2 (since it is a fixed value) and simply consider minimising x1 (instead of x1-x2). Then, denoting by P(u) the cumulative normal distribution function for mean=0 and variance=1 (i.e. in R: pnorm(u,0,1)), and by Q(p) its inverse, corresponding to qnorm(p,0,1), we have (again if I have understood right): P((x1 - 0.0032)/x) = 0.7 so x1 = 0.0032 + x*Q(0.7) and therefore, since Q(0.7) > 0 and x must be positive, the value of x1 can be made as close to 0.032 as you please (but greater than 0.032) by taking x small enough. Hence there is no strictly minimising value of x, but the greatest lower bound of all possible values of x1 is 0.032. Then you can subtract x2. The fact that there is no positive value of x which gives this bound as the value probably explains the failure of your optim() attempt. Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 18-Jun-07 Time: 17:46:01 ------------------------------ XFMail ------------------------------ ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.