jmbejara / comp-econ-sp19

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

MLE Q6 negative std #46

Closed sicelyli closed 5 years ago

sicelyli commented 5 years ago

I got a negative std estimation(-0.03892627616515054), but not sure what goes wrong with my code: Screen Shot 2019-05-12 at 7 31 26 PM

jmbejara commented 5 years ago

Try rewriting your PDF so that sigma appears as sigma**2 or the absolute value of sigma. You can do this without changing the PDF. An alternative is to add a constraint to the optimizer to force sigma to be positive. However, this can introduce some numerical issues that make the first option easier and more reliable.