jmbejara / comp-econ-sp18

Main Course Repository for Computational Methods in Economics (Econ 21410, Spring 2018)
16 stars 23 forks source link

Bresnahan Reiss Q2 #63

Closed isabelalmazan closed 6 years ago

isabelalmazan commented 6 years ago

Hi Jeremy, I was able to get approximately the same log-likelihood (800001109) using theta0 and that in the paper (263.09) using the parameters from Table 4 in the paper. However when I tried running the optimization with bounds on the alphas only, I can't get my optimization's log-likelihood to converge to the provided result.

I've tried (-0.01, None) and (-1, None) as bounds on the alphas - since the bounds are strict inequalities, and (None, None) on the rest - but neither of them seem to work, and the log-likelihood is stuck at ~205. Can you provide some guidance?

jmbejara commented 6 years ago

Hi @isabelalmazan . Sorry, the bounds should be on the alphas as well as the gammas (not including gamma_L). I am using tuples (0, np.inf) as the bounds on the alphas and gammas. And, for what it's worth, I'm using the basic scipy.optimize.minimize.

Hope this helps!

isabelalmazan commented 6 years ago

I tried your bounds but am still way off: screen shot 2018-05-16 at 10 13 50 am screen shot 2018-05-16 at 10 14 04 am

The closest I've been able to get to the 263 is 261, which I got by "cheating" and using these extra specific bounds: screen shot 2018-05-16 at 10 15 41 am

Even with the results from the cheating/ specific bounds minimization, my np.allclose function returns False at rtol=0.2, so I'm not really sure where I'm going wrong?

jmbejara commented 6 years ago

I think the best thing to do to diagnose the problem is to test a few values of the log-likelihood function. We should be getting the exact same numbers. Try the following random test:

theta_test = np.array([1, 1, 1, 1, -1, -0.03,
0.01, -0.02, 0.8, 0.03, 0.1, 0, 0.1, 0.5,
1, 1, 1, 0.1, -1])

neg_log_like(theta_test)

When I run this, I get 324.2397071494959

isabelalmazan commented 6 years ago

Ok, I get 269.9912536323145. I'll go back into my log_like function and see where I made a mistake.