jmbejara / comp-econ-sp19

Main Course Repository for Computational Methods in Economics (Econ 21410, Spring 2019)
48 stars 26 forks source link

MLE for Bernoulli distribution #77

Closed rhuselid closed 5 years ago

rhuselid commented 5 years ago

I am working through the suggested problems on the review guide and I am running into an issue where when I try to maximize the choice of param for a bernoulli distribution, I get the initial guess from the minimizer almost every time. I think it is something to do with the bounds (the minimizer tries different param values, but then goes back to the initial guess. I have been using this framework for other distributions so I don't think it is related to the code, but there could be an error there as well

Do you have any suggestions as to what would be causing this?

Thanks!

Link to working example; https://colab.research.google.com/drive/1MRsLYU2VtVFHeYbmZIj1YzGijg9e9O69

jmbejara commented 5 years ago

Try using the scipy function called minimize_scalar. See if that changes anything.

rhuselid commented 5 years ago

Thanks! That fixed it