-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 For what it's worth, you can use either nlminb (directly) or optimx within the mle2 wrapper by specifying the 'optimizer' parameter ... this gives you flexibility in optimization along with the convenience of mle2 (likelihood ratio tests via anova(), likelihood profiling, etc.)
On 15-01-15 09:26 AM, Ravi Varadhan wrote: > Hi, > > > > I tried your problem with optimx package. I found a better > solution than that found by mle2. > > > > ?library(optimx) > > > > # the objective function needs to be re-written > > LL2 <- function(par,y) { > > lambda <- par[1] alpha <- par[2] beta <- par[3] R = > Nweibull(y,lambda,alpha,beta) > > -sum(log(R)) } > > > > optimx(fn=LL2, par=c(.01,325,.8),y=y, > lower=c(.00001,.00001,.00001),upper = c(Inf, > Inf,Inf),control=list(all.methods=TRUE)) > > > > # Look at the solution found by `nlminb' and `nmkb'. This is the > optimal one. This log-likelihood is larger than that of mle2 and > other optimizers in optimx. > > > > If this solution is not what you are looking for, your problem may > be poorly scaled. First, make sure that the likelihood is coded > correctly. If it is correct, then you may need to improve the > scaling of the problem. > > > > > > Hope this is helpful, > > Ravi > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJUt87VAAoJEOCV5YRblxUH9E4H/ismNjBi/diA7db1f4EtIYUz fk0V1GIjAkhNr+gxs8bu6CBAMB2f/ufw+9ey2X6yHlzvgfwzIwNafgg9c5qVlArF xD8A4w/4G9cRsQFX8yySEQMP7dH5tyCTeRHU0sEcTbY+vV/NtWAYpF7k36He0QnQ Jz/Gfmjt/TTVlcsL4crr8IdOjP34mq7H1SGXKNoBymhaggkBXXjG+IlhPK3/HE4s 2LFKusdSVDiJCCR+kafwyKxk76Lf2WADw9/RaysWfW0/v5O5dWU4IuvK2//nzvts 7rKMkF9/zlT+LgLNo7LON+RTOeDtTMqyA10Vu+txQTKH4AcMP4LqYoiGMerl6O0= =cHEo -----END PGP SIGNATURE----- ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.