jmbejara / comp-econ-sp18

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

Fixed Effects Q2 #74

Closed afgong closed 6 years ago

afgong commented 6 years ago

sfe = smf.mixedlm('fatalityrate ~ sb_usage + speed65 \

sfe2 = sfe.fit() sfe2

I've copied the format of your code from the Fixed Effects Rosetta Stone notebook, but the code above, which I've written for Q2, is giving me this error:

IndexError: index 556 is out of bounds for axis 1 with size 556

Any hint as to why this is the case? Thanks so much!

afgong commented 6 years ago

Would it perhaps have to do with missing data?

jmbejara commented 6 years ago

Hi Annabella,

I'm not sure what the error is here, but I would recommend using the linearmodels package. I give the example of using either statsmodels or linearmodels in my Rosetta stone notebook. But I think the linearmodels package is easier to use.

Check out the documentation here: https://bashtage.github.io/linearmodels/doc/panel/models.html#linearmodels.panel.model.PanelOLS