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 advice

From   "Schaffer, Mark E" <>
To   <>
Subject   st: RE: two-way clustering advice
Date   Thu, 30 Aug 2012 00:55:14 +0100


Have you tried using the partial() option to partial out anything that
isn't of interest?  Maybe your dcid* dummies?  This can reduce the
dimensions of the matrices -ivreg2- is working with quite a lot, and
that would speed things up as well as improve the numerical accuracy.


> -----Original Message-----
> From: [mailto:owner-
>] On Behalf Of Dimitriy V. Masterov
> Sent: 30 August 2012 00:08
> To: Statalist
> Subject: st: two-way clustering advice
> 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
> 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
> covariance matrix as
> Cov(cluster(state)) + Cov(cluster(time)-Cov(cluster(state*time))), so
> are 3 separate regressions that are estimated, but this seems fairly
> Toy models seem to work very well. Any advice about how I can figure
> where the bottleneck is?
> I have not tried cluster2 (from
> _programming.htm)
> yet, since it does not have as rich a set of diagnostics.
> *
> *   For searches and help try:
> *
> *
> *

Heriot-Watt University is the Sunday Times
Scottish University of the Year 2011-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