linearmodels icon indicating copy to clipboard operation
linearmodels copied to clipboard

Panel regression with lagged dependent variables

Open spillz opened this issue 7 years ago • 7 comments

It looks like many of the needed pieces (esp. GMM IV) are in place to do Arellano-Bond style regressions with a lagged dependent variable, but it doesn't look like it is actually implemented. If that's the case do you have thoughts on how to implement it?

spillz avatar Jun 27 '17 15:06 spillz

Possibly. I haven't started thinking about Dynamic Panel models to think about what a good interface would look like. I don't think the univariate GMM IV is enough to estimate the AB model.

bashtage avatar Jun 27 '17 22:06 bashtage

Based on the Wikipedia entry I think the basic AB estimator can be estimated using your univariate GMM IV estimator. I started playing around in an IPython Notebook and created a simple class to replicate the instrument structure (scroll to the end):

https://gist.github.com/spillz/5cab778e146e37020d16c40eba9d9839

The more complicated AB estimator is a system IV. Is that something you have thought about implementing?

spillz avatar Jun 27 '17 23:06 spillz

Actually, scratch this:

The more complicated AB estimator is a system IV.

It turns out it just stacks the differenced and undifferenced data and adds some additional instruments for the undifferenced set. So it's not really a "system". Should be easy to implement.

spillz avatar Jun 28 '17 02:06 spillz

Thorough documentation by Roodman (creator of xtabond2):

http://www.stata-journal.com/article.html?article=st0159

spillz avatar Jun 28 '17 07:06 spillz

A gist or similar would be helpful.

bashtage avatar Jun 28 '17 10:06 bashtage

Yes, I'll add the system GMM estimator to the gist I linked above.

spillz avatar Jun 28 '17 13:06 spillz

Dear Users,

I wanted to ask you a question related to Dynamic Panel Data and System-GMM models. When trying to run the System-GMM model, I get the following error message in STATA:

quadcross(): 3900 unable to allocate working space xtabond2_mata(): - function returned error : - function returned error r(3900);

@droodman tol me that perhaps I was using too many instruments. My annual panel covers 1960-2015, and around 160 countries. The code looks something like:

quietly: xtabond2 y l.y x1 x2 x3 x4 x5 year* , gmmstyle(y, laglimits(2 .)) gmmstyle(x1 x2 x3 x4 x5 , laglimits(1 .)) ivstyle(year* , p) noleveleq robust nodiffsargan nomata

Thanks for your help

asmithbravo avatar Nov 14 '20 08:11 asmithbravo