Bookmark and Share

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

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

st: RE: Two -way clustering (ivreg2/xtivreg2/cgmreg): warning messages, uncomprehensible behavior

From   "Schaffer, Mark E" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Two -way clustering (ivreg2/xtivreg2/cgmreg): warning messages, uncomprehensible behavior
Date   Mon, 21 Apr 2014 22:18:05 +0000


-ivreg2- and -cgmreg- are giving you basically the same message.  This problem can happen with 2-way clustering; I think if you follow up some of the literature on this, you'll find some discussion.

The only thing I can suggest is partialling-out all the regressors you aren't interested in, using the partial(.) option of ivreg2/xtivreg2.  Unless you are using the CUE estimator, this leaves the remaining coefficients unchanged, and often solves the problem.


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Kuba Bembenek
> Sent: 21 April 2014 20:13
> To: [email protected]
> Subject: st: Two -way clustering (ivreg2/xtivreg2/cgmreg): warning messages,
> uncomprehensible behavior
> Dear Statalists,
> what I am doing:
> I am estimating a panel model via First Difference estimator. I either
> use ivreg2 and take the first differences myself, or xtivreg2, fd. The
> panal ist unbalanced and consists of seven sectors across 24 countries
> ( 168 panel units) observed over 33 years. In the model, I include
> seven industry specific trends (after FD: industry specific dummies)
> and year dummies.
> The problem that occurs:
> In this model I want to cluster across industries and countries. I
> almost always get the message "Warning: estimated covariance matrix of
> moment conditions not of full rank.model tests should be interpreted
> with caution." This even the case when the number of clusters exceeds
> the number of regressors to be estimated (in both cluster dimensions).
> Furthermore no singleton dummy variable is included
> Of course due to the number of time dummies etc., the number of
> clusters would not be sufficient in both dimensions if I just used the
> identification variables for countries and industries. To evade this
> problem,  I generate id variables for three year intervals,four year
> intervals, or each individual year to interact them (egen ..
> =group(threeyear country) etc.) with the country and industry
> indicator. The only combination where two-way custering works is the
> industry*year and country*year case. In all the other cases I get the
> error message above. However if I just cluster over one dimension,
> e.g.  fouryearid*industry or threeyear*country, it works. This
> confuses me as to my knowledge the numbers of coefficients that can be
> jointly tested is restrained by the "cluster dimension" with the
> fewest number of clusters.
> Does anybody have an idea what could be happening here? I would be
> very thankful for some help!
> Best Regards
> Kuba Bembenek
> additional info:
> I also tried the cgmreg command  (described here:
> and for every estimation, also for the year*country and
> industry*clusters, I get the following message:
> " Raw estimated variance matrix was non-positive semi-definite.
> -cgmreg- is replacing any/all negative eigenvalues with 0"
> *
> *   For searches and help try:
> *
> *
> *

Sunday Times Scottish University of the Year 2011-2013
Top in the UK for student experience
Fourth university in the UK and top in Scotland (National Student Survey 2012)

We invite research leaders and ambitious early career researchers to 
join us in leading and driving research in key inter-disciplinary themes. 
Please see for further information and how
to apply.

Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

*   For searches and help try:

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