A Question about MLE in R

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

A Question about MLE in R

Cisy
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]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: A Question about MLE in R

Peter Dalgaard-2
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 <[hidden email]> 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]]
>
> ______________________________________________
> [hidden email] 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: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: A Question about MLE in R

J C Nash
In reply to this post by Cisy
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]]
>
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: A Question about MLE in R

Ravi Varadhan-2
In reply to this post by Cisy
I agree with John that SANN should be removed from optim.


More importantly, the default choice of optimizer in optim should be changed from "Nelder-Mead" to "BFGS."   Nelder-Mead is a bad choice for the most commonly encountered optimization problems in statistics.  I really do not see a good reason for not changing the default in optim.


Best regards,

Ravi

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: A Question about MLE in R

Andrew Robinson-2
In reply to this post by J C Nash
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: [hidden email]
Website: https://researchers.ms.unimelb.edu.au/~apro@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 <[hidden email]>, 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]]


______________________________________________
[hidden email] 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.


______________________________________________
[hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: A Question about MLE in R

Andrew Robinson-2
In reply to this post by Ravi Varadhan-2
Hi Ravi,

that's an interesting claim and N-M.  Can you provide any reading matter to support it?

Cheers,

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: [hidden email]
Website: https://researchers.ms.unimelb.edu.au/~apro@unimelb/

I acknowledge the Traditional Owners of the land I inhabit, and pay my respects to their Elders.
On Jul 24, 2020, 10:54 PM +1000, Ravi Varadhan <[hidden email]>, wrote:
I agree with John that SANN should be removed from optim.


More importantly, the default choice of optimizer in optim should be changed from "Nelder-Mead" to "BFGS." Nelder-Mead is a bad choice for the most commonly encountered optimization problems in statistics. I really do not see a good reason for not changing the default in optim.


Best regards,

Ravi

[[alternative HTML version deleted]]

______________________________________________
[hidden email] 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]]

______________________________________________
[hidden email] 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.