jmaih / RISE_toolbox

Solution and estimation of Markov Switching Rational Expectations / DSGE Models
BSD 3-Clause "New" or "Revised" License
103 stars 76 forks source link

is there is something random in the RISE toolbox estimation? #180

Closed emml-ameyaw-kofi closed 1 year ago

emml-ameyaw-kofi commented 1 year ago

I am replicating DSGE/Tutorial 2...4 estimated models. For two models, I get similar results as in the pdf, for the other two models, the results are very different from the one in the pdf. What may be causing this? MATLAB version or something random in estimation?

MergedImages

jmaih commented 1 year ago

In theory, the results depend on everything

And in general, for complicated problems, various optimizers will not necessarily reach the same posterior mode.

The figures in the pdf have been plotted with the specific values obtained using the default optimizer of RISE, which is not very powerful and depends on the vagaries of Matlab.

On Wed, Apr 19, 2023 at 3:18 PM emml-ameyaw-kofi @.***> wrote:

I am replicating DSGE/Tutorial 2...4 estimated models. For two models, I get similar results as in the pdf, for the other two models, the results are very different from the one in the pdf. What may be causing this? MATLAB version or something random in estimation?

[image: MergedImages] https://user-images.githubusercontent.com/130836876/233086249-17ca825a-2291-4957-8139-2ff55d734e9c.jpg

— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBT5PPGYDVCB5MFCIEW3XB7QZNANCNFSM6AAAAAAXECBZDA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

emml-ameyaw-kofi commented 1 year ago

Many thanks for the reply. It helps a lot. If I may ask, what is your preferred way to obtain a more robust results? What do you suggest about this issue?

jmaih commented 1 year ago

There is no magic bullet here!

The optimal optimizer depends on:

Matlab has several optimizers: fminunc, fminsearch, fmincon, etc. They work well for some problems and I use them mostly for teaching purposes only. Otherwise, for serious work I use my own optimizers.

Please read this paper ( https://www.frbsf.org/wp-content/uploads/sites/4/wp09-01bk.pdf) on page 18 if you want to understand how complicated estimation can be.

On Wed, Apr 19, 2023 at 3:41 PM emml-ameyaw-kofi @.***> wrote:

Many thanks for the reply. It helps a lot. If I may ask, what is your preferred way to obtain a more robust results? What do you suggest about this issue?

— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/180#issuecomment-1514759004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBTZDWHXOCDVJBH4TVDLXB7TR3ANCNFSM6AAAAAAXECBZDA . You are receiving this because you commented.Message ID: @.***>

emml-ameyaw-kofi commented 1 year ago

Many thanks for the paper, Maih. Not looking for a bullet magic though..:). It seems to me one cannot obtain a robust results with this toolbox as it stands...right? Would you suggest using it? Would you mind sharing your powerful optimizers? :)

fminunc, fminsearch, fmincon. How do you select which optimizer to use? By checking the log MDD of the estimation?

jmaih commented 1 year ago

What I told you is true for all nonlinear estimations, irrespective of the platform.I sense some disingenuousness and manipulation on your part, which I do not welcome.Take careSendt fra min iPhone20. apr. 2023 kl. 01:57 skrev emml-ameyaw-kofi @.***>: Many thanks for the paper, Maih. Not looking for a bullet magic though..:). It seems to me one cannot obtain a robust results with this toolbox as it stands...right? Would you suggest using it? Would you mind sharing your powerful optimizers? :)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

emml-ameyaw-kofi commented 1 year ago

Sorry if I said anything that offended you. I am not disingenuousness and manipulative. I was looking for a solution on dynare forum...and the thread pointed to here. According to Pfeifer, dynare is not planning to include markov switching models because there is already a toolbox for it...and he pointed here. I have been trying several examples over the week...but when I try them again, sometimes I see differences in the results although I didn't change anything. That is what got me to ask this question. From your answer, you seemed to suggest that you use fminunc, fminsearch, fmincon mostly for teaching purposes and not for serious work. I want to use this toolbox for my dissertation...I am not disingenuousness and manipulative, I only seek to obtain a more robust results. If you have other optimizers that are more powerful than fminunc, fminsearch, fmincon that can give a more robust results, I would be glad if you could share...if you don't mind. Btw...thanks for your previous answers and sorry if I offended you. I did not intend to.

jmaih commented 1 year ago

What I meant is that for serious work you will have to do a thorough search, which I never did for the examples you’ve been looking at. That’s why I pointed you to an example of paper that does a thorough search.In Dynare we have upwards of 10 different optimizers, again just to illustrate the fact that there is no perfect optimization procedure. Some of those optimizers are deterministic, some others are stochastic. Stochastic search algorithms such as csminwel will not necessarily give the same results if you run them twice on the same problem without changing anything. If you search thoroughly, e.g. using several runs, obviously you will consider the best among all the peaks you will have found. Unless the problem is simple enough, you can never prove that you have reached the global peak.I use fmincon for teaching purposes because it converges quickly, not because it achieves the best possible results. The results that you looked at were computed, if I am not mistaken, in 2014 using a matlab version of that time. The goal here was just to illustrate how estimation is performed in RISE.Finally, priors play an important role too. Very informative priors will increase the chance of always finding the same results. But then, again, if you are too informed or informative, there is no point in doing estimation.J. Sendt fra min iPhone20. apr. 2023 kl. 05:58 skrev emml-ameyaw-kofi @.***>: Sorry if I said anything that offended you. I am not disingenuousness and manipulative. I was looking for a solution on dynare forum...and the thread pointed to here. According to Pfeifer, dynare is not planning to include markov switching models because there is already a toolbox for it...and he pointed here. I have been trying several examples over the week...but when I try them again, sometimes I see differences in the results although I didn't change anything. That is what got me to ask this question. From your answer, you seemed to suggest that you use fminunc, fminsearch, fmincon mostly for teaching purposes and not for serious work. I want to use this toolbox for my dissertation...I am not disingenuousness and manipulative, I only seek to obtain a more robust results. If you have other optimizers that are more powerful than fminunc, fminsearch, fmincon that can give a more robust results, I would be glad if you could share...if you don't mind. Btw...thanks for your previous answers and sorry if I offended you. I did not intend to.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>