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 advice

From   "Dimitriy V. Masterov" <>
To   Statalist <>
Subject   st: two-way clustering advice
Date   Wed, 29 Aug 2012 16:08:10 -0700

I am estimating a twelfth-difference panel data equation. My panels
are US counties (N=3101) and the variables are measured every month
for 2008-2012 (T=53).

The specification is -ivreg2 S12.(lny L1.x) dcid*, cluster(state
dateym)-. The intercept in this model gives me a national trend and
the coefficients on the dcid dummies estimate the county trends.

I would like to cluster at the state level (S=48) and for time, and I
was hoping to use the user-written ivreg2. This has been running more
than ten times longer than it takes to cluster on state or time alone,
so I am not sure why it's taking so long. My understanding is that
Stata actually calculates the variance covariance matrix as
Cov(cluster(state)) + Cov(cluster(time)-Cov(cluster(state*time))), so
there are 3 separate regressions that are estimated, but this seems
fairly doable. Toy models seem to work very well. Any advice about how
I can figure out where the bottleneck is?

I have not tried cluster2 (from
yet, since it does not have as rich a set of diagnostics.

*   For searches and help try:

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