jmbejara / comp-econ-sp19

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

mle_args #58

Closed erineidschun closed 5 years ago

erineidschun commented 5 years ago

I am confused as to what exactly mle_args should be when we are running scipy.optimize.minimize. Both of the choices below give me compile errors.

1) mle_args = df 2) mle_args = df.TPOP.values, df.OPOP.values, df.PGRW.values, df.NGRW.values, df.OCTY.values, df.ELD.values, df.PINC.values, df.LNHDD.values, df.FFRAC.values, df.LANDV.values

theta = opt.minimize(neg_log_lik, theta0, args = (mle_args))

Can you explain in general what mle_args is supposed to be? I am not understanding it from our past notes/hw 5. Thanks!

jmbejara commented 5 years ago

Hi @erineidschun . Yeah. It really depends entirely on how you choose to write the function neg_log_lik. You might not need them at all. The point of the args keyword argument in minimize is to allow the programmer to send extra arguments to the function to be optimized. In your case, that's neg_log_lik. So, if your neg_log_lik function takes in extra arguments besides theta, then you need it. Otherwise, you don't.