Hi, I encounter a problem. I use optim() function in R to estimate likelihood function and the method is SANN in the optim function. out <- optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=5000000)) However, I find that each time I run the program, I will get different values of parameters. My initial values are same, but the number of iterations has reached the maximum limit. I expanded the number of iterations to 5 million, but it??s still wrong. I want to know what I should do. Is anyone willing to help me? Thanks so much! Best, Cisy [[alternative HTML version deleted]]
Simulated annealing is a probabilistic method and will do things like that. You should probably read an introduction to the method, e.g. the Wikipedia page. Not too unlikely, you really want to use one of the other methods in optim() (or better still optimr from the optimx package). (I take it that logLik is really the _negative_ log-likelihood function, right? Otherwise, the problem could be that you are minimizing, not maximizing.) -pd> On 22 Jul 2020, at 09:06 , Zixuan Qi <zixuan.qi at duke.edu> wrote: > > Hi, > > I encounter a problem. I use optim() function in R to estimate likelihood > function and the method is SANN in the optim function. > out <- > optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=5000000)) > > However, I find that each time I run the program, I will get different > values of parameters. My initial values are same, but the number of > iterations has reached the maximum limit. I expanded the number of > iterations to 5 million, but it?s still wrong. > > I want to know what I should do. Is anyone willing to help me? Thanks so > much! > > Best, > Cisy > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
SANN is almost NEVER the tool to use. I've given up trying to get it removed from optim(), and will soon give up on telling folk not to use it. JN On 2020-07-22 3:06 a.m., Zixuan Qi wrote:> Hi, > > I encounter a problem. I use optim() function in R to estimate likelihood > function and the method is SANN in the optim function. > out <- > optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=5000000)) > > However, I find that each time I run the program, I will get different > values of parameters. My initial values are same, but the number of > iterations has reached the maximum limit. I expanded the number of > iterations to 5 million, but it??s still wrong. > > I want to know what I should do. Is anyone willing to help me? Thanks so > much! > > Best, > Cisy > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help at 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. >
Hi John, I wonder if you can suggest some reading material on that topic? A cursory search of the net doesn't uncover anything obvious. Andrew -- Andrew Robinson Director, CEBRA and Professor of Biosecurity, School/s of BioSciences and Mathematics & Statistics University of Melbourne, VIC 3010 Australia Tel: (+61) 0403 138 955 Email: apro at unimelb.edu.au Website: https://researchers.ms.unimelb.edu.au/~apro at unimelb/ I acknowledge the Traditional Owners of the land I inhabit, and pay my respects to their Elders. On Jul 22, 2020, 10:49 PM +1000, J C Nash <profjcnash at gmail.com>, wrote: SANN is almost NEVER the tool to use. I've given up trying to get it removed from optim(), and will soon give up on telling folk not to use it. JN On 2020-07-22 3:06 a.m., Zixuan Qi wrote: Hi, I encounter a problem. I use optim() function in R to estimate likelihood function and the method is SANN in the optim function. out <- optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=5000000)) However, I find that each time I run the program, I will get different values of parameters. My initial values are same, but the number of iterations has reached the maximum limit. I expanded the number of iterations to 5 million, but it??s still wrong. I want to know what I should do. Is anyone willing to help me? Thanks so much! Best, Cisy [[alternative HTML version deleted]] ______________________________________________ R-help at 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. ______________________________________________ R-help at 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. [[alternative HTML version deleted]]