[R] how to find the minimum

Charles C. Berry cberry at tajo.ucsd.edu
Tue Apr 29 06:51:36 CEST 2008

On Mon, 28 Apr 2008, Bin Yue wrote:

> Dear friends:
>     I am a new R user, and not very good at statistics and maths
>     I find it difficult to find the minimum of this item:
>     ((p*(b-1)-1)*(p+1)^(b-1)+1)/p^2
>    It seems that the method optim can find the minimum. I tried several
> times , but R constanly tells that " failure to find b or p"
>    Would you please give some suggestions?

1) follow the posting guide

2) "provide commented, minimal, self-contained, reproducible code"

3) be sure optim 'understands' what the domain of your function is. You do 
this by choosing explicit constraints or a suitable reparameterization.

4) make sure you understand your function well enough to carry out 3. You 
do this by plotting your function and/ or plugging in some trial values. 
Or you do some actual math and try to figure out if there are 
multiple minima, places where derivatives do not exist, and so on. If 
there are such troublesome issues, you will need to sort them out before 
optim has a chance at finding a useful answer.



>    Thanks in advance.
>    Best wishes,
>    Bin Yue
> -----
> Best regards,
> Bin Yue
> *************
> student for a Master program in South Botanical Garden , CAS
> -- 
> View this message in context: http://www.nabble.com/how-to-find-the-minimum-tp16952701p16952701.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at 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.

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

More information about the R-help mailing list