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: Two -way clustering (ivreg2/xtivreg2/cgmreg): warning messages, uncomprehensible behavior

From   Kuba Bembenek <>
Subject   st: Two -way clustering (ivreg2/xtivreg2/cgmreg): warning messages, uncomprehensible behavior
Date   Mon, 21 Apr 2014 21:12:56 +0200

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:

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