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

st: Re: IVREG2 and Multi-way Clustering

 From Jessie C To statalist@hsphsun2.harvard.edu Subject st: Re: IVREG2 and Multi-way Clustering Date Sun, 29 Jan 2012 18:23:31 -0500

```Mark,

Thank you for your continued patience.  I am very grateful for you
continuing to take the time to help.

I am confused though as to why what I did was just a coincidence.  I
looked around some more and just found another paper by Cameron and
Gelbach:
www.econ.ucdavis.edu/working_papers/10-7.pdf, p. 14

It says that the two-way clustering is based on a one-way clustering formula:

"For two-way clustering this robust variance estimator is easy to
implement given software that computes the usual one-way
cluster-robust estimate. We obtain three different cluster-robust
\variance" matrices for the estimator by one-way clustering in,
respectively, the first dimension, the second dimension, and by the
intersection of the first and second dimensions.  Then add the first
two variance matrices and, to account for double-counting, subtract
the third.  Thus V_{two-way}(beta) = V_1(beta) + V_2(beta) - V{1
intersection 2}(beta)."

On Sun, Jan 29, 2012 at 4:42 PM, Jessie C <jessiecoh@gmail.com> wrote:
> Mark,
>
> Thank you very much for your response and for taking the time to help
> out.  I greatly appreciate it.
>
> 1. Your example makes sense of the 2 X 2.  z_1 has 2 clusters.  z_2
> has 2 clusters.  The union of z_1 and z_2 is 4 clusters but also 4
> observations.
>
> I don't quite understand then the 2-way clustering formula in terms of
> 1-way clusters.
>
> Cameron, Gelbach, and Miller say:
>
> 1. OLS regression of y on X with variance matrix estimate computed
> using clustering on g in the set of {1, 2, ...G};
> 2. OLS regression of y on X with variance matrix estimate computed
> using clustering on h  in the set of {1, 2, ...H};
> 3. OLS regression of y on X with variance matrix estimate computed
> using clustering on (g, h)  in the set of {(1, 1), ..., (G, H)};
>
> Given these three components, V[beta] is computed as the sum of the
> …first and second components, minus the third component.
>
> I thought that would correspond with:
> i. reg y x, cluster(g)
> ii. reg y x, cluster(h)
> iii. reg y x, cluster(i) where egen i = group(g h)
> and the standard error is se(i) + se(ii) - se(iii) or
> sqrt(se(i)^2 + se(ii)^2 - se(iii)^2)
>
> I tried an example in Stata and it worked out using the sqrt formula.
> Not sure if that's just a coincidence.
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```