jmbejara / comp-econ-sp19

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

wrong value for Q1 #63

Closed sicelyli closed 5 years ago

sicelyli commented 5 years ago

Hi, I'm not sure how I could edit my code so it could produce the right result for log likelihood. Screen Shot 2019-05-20 at 5 28 10 PM Screen Shot 2019-05-20 at 5 27 37 PM Screen Shot 2019-05-20 at 5 27 49 PM

sicelyli commented 5 years ago

I just found a mistake when I defined V and F. After editing the mistakes, my neg log like is -900001059.7647647.

jmbejara commented 5 years ago

I don't check for nan's in my code. After I replace the negative infinities, it doesn't look like I have any nans in my output. I don't know why you would be getting some if you are.

Also, btw, you might want to use numpy arrays where you can. You can replace the python loops, the list comprehension, and the numpy lists, with numpy arrays and vectorized numpy functions (e.g. np.sum instead of sum). This should speed things up.

jmbejara commented 5 years ago

Take a look at this as well: https://github.com/jmbejara/comp-econ-sp19/issues/61#issuecomment-494134881

Also, the ordering of your variables is a little different than the ordering implied by theta_br. You can check the paper to see the ordering. The ordering that I'm using matches the comment in the HW,

We are replicating this paper for "Tire Dealers" only. Thus, we will use the following variables. For 𝑉 we will use ELD, PINC, LNHDD, FFRAC. For 𝐹 we will use LANDV. For 𝑆 , we will use TPOP, OPOP, NGRW, PGRW, OCTY.