Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: GMM and "few observations" error... with same N sometimes it works sometimes it does not


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: GMM and "few observations" error... with same N sometimes it works sometimes it does not
Date   Thu, 11 Jul 2013 10:08:33 +0100

The number of observations may be the same, but it seems most likely
that something is unusual about the dataset that failed. I'd check for
missing values or equivalently a variable being string that should be
numeric.

Nick
[email protected]

On 11 July 2013 09:56, Claudio Baccianti <[email protected]> wrote:

> I encountered the "cannot have fewer observations than parameters"
> error message when running the GMM command, both on Stata 12.1 and 11.2
> (Windows 32bit).
>
> I have a loop that runs the GMM on N separate sectoral datasets. Each
> dataset represents a panel for one sector and they all have the same
> number of observations. The loop works fine until one point, when it
> stops giving the error message r(2001) "cannot have fewer observations
> than parameters". The sector that gets stuck has 378 obs, exactly the
> same number of the previous successful ones. That is really strange.
>
> Here is the gmm command I am using:
>
> ...
> foreach j of local sector{
> use datasect`j', clear
> [...]
> gmm (eq1:Y1 - {b1}*X1 - {du1: c1-c26}) (eq2:Y2 - {b1}*X2 - {du2:
> c1-c26}) (eq3:Y3 - {b1}*X3 - {du3: c1-c26}), instruments(eq1: L1.X1
> c1-c26, noconstant) instruments(eq2: L1.X2 c1-c26, noconstant)
> instruments(eq3: L1.X3 c1-c26, noconstant) wmatrix(hac bartlett 1)
> winitial(identity) vce(hac bartlett 1)
> [...]
> }
>
> where c* are dummy variables.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index