Generalized Method of Moments Estimation in Python

4.7k views Asked by At

I'm am trying to perform Instrumental Variable (IV) regression in Python. I saw online that the statsmodels.gmm package has the function I need (http://statsmodels.sourceforge.net/devel/gmm.html#), but when I ran import statsmodels.gmm as gmm in Python I get this error No module named gmm . I'm using ipython with python 2.7.9. Any suggestions would be much appreciated.

1

There are 1 answers

1
Josef On BEST ANSWER

GMM and related IV estimators are still in the sandbox and have not been included in the statsmodels API yet.

The import needs to be directly from the module

from statsmodels.sandbox.regression import gmm

Then, these classes can be accessed with, for example gmm.GMM

The main models that are currently available are:

GMM, IV2SLS, IVGMM, LinearIVGMM, NonlinearIVGMM

The mailing list has a recent discussion on the current status, and links to "secret" Gists https://groups.google.com/d/msg/pystatsmodels/o6NY7qGrPw0/vzf897jy3vMJ

(I just found that the t_test doesn't work for a GMM model.)