[R] R 3.1.2 mle2() function on Windows 7 Error and multiple solutions

Ravi Varadhan ravi.varadhan at jhu.edu
Thu Jan 15 15:26:24 CET 2015


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



	[[alternative HTML version deleted]]



More information about the R-help mailing list