Re: [R] Optimization

From: Ted Harding <>
Date: Mon, 18 Jun 2007 17:46:05 +0100 (BST)

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


  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,

E-Mail: (Ted Harding) <> Fax-to-email: +44 (0)870 094 0861
Date: 18-Jun-07                                       Time: 17:46:01
------------------------------ XFMail ------------------------------

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 18 Jun 2007 - 16:52:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Jun 2007 - 17:32:04 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.