<p>First, that is only a rule of thumb, exact number of clusters you need in any case is context dependent.</p>
<p>Second, actually as pointed out by <a href="https://direct.mit.edu/rest/article/90/3/414/57731/Bootstrap-Based-Improvements-for-Inference-with" rel="noreferrer">Cameron et al (2008)</a>:</p>
<blockquote>
<p>A practical limitation of inference with cluster-robust
standard errors is that the asymptotic justification assumes
that the number of clusters goes to infinity.</p>
</blockquote>
<p>Consequently, clustered standard errors only provide correct inference asymptotically. However, if you ever took any statistics class you might already know that the sufficiently large samples for asymptotic results to hold are typically samples with sample size of 30-40 observations. For example, for standard regression a <em>typically</em> a sufficient sample size to justify its asymptotic properties  is 30 observations per independent regressors (see Verbeek A Guide to Modern Econometrics pp 36).</p>
<p>For a clustered errors a rule of thumb is 30-40 (clusters i.e. groups don't confuse this with observation count) although most authors go with the upper value of 40 or even Angrist and Pischke went for 42 (see MHE pp 319*). Now the rule is arbitrary in the sense that of course every problem is unique and sometimes 29 or 31 clusters might be sufficient and sometimes you might need even 45 clusters (the other answer is correct in pointing out more is always better).</p>
<p>However, the number is not arbitrary in a sense its completely made up. The number of 30-40 cluster is actually based on examination of how different errors affect statistical inferences from Monte-Carlo simulations such as the one below (table taken from  Cameron et al 2008).</p>
<p>You can see that as number of clusters increases the rejection rates (and their standard deviation) drops. Already with 30 clusters you can see that clustering errors are doing pretty well but depending on a setting more clusters might be needed still.</p>
<p>Minimum of 40 clusters is very reasonable rule of thumb for an applied econometrician. If you would want to get to exact number you would have to do some Monte-Carlo simulations for your problem and most likely you would find that the result is very close to the rule of thumb. Consequently,  if you are willing to tolerate some (very) small possibility of having incorrect inference <em>minimum</em> of 40 clusters is reasonable rule of thumb (again more is of course even better). If you are willing to tolerate larger but still small possibility of having incorrect inference you can even use 30 as a rule of thumb.</p>
<p><a href="https://i.sstatic.net/orZ9a.png" rel="noreferrer"><img src="https://i.sstatic.net/orZ9a.png" alt="enter image description here" /></a></p>
<p><sub> * Althought that was partially for the lolz since they constantly reference Douglas Adams The Hitchhiker's Guide to the Galaxy </sub></p>

CC BY-SA 4.0
2021-06-12T10:40:21.030Z
2021-06-12T10:45:47.543Z
2021-06-12T10:45:47.543Z
1muflon1
<p>First of all, clustering only changes the (estimated) standard deviations of your coefficients. Whether you cluster or not will not change the coefficients themselves and therefore also not the &quot;true quality&quot; of these estimates.</p>
<p>If you cluster, this means that you assume the observations within a given cluster are not independent. If this is true, then the true number of independent observations only equals the number of clusters. So if you have <span class="math-container">$N$</span> observations and <span class="math-container">$G$</span> clusters and if your data is not independent within each cluster, it is like you only have <span class="math-container">$G$</span> observations to work with.</p>
<p>Given that, for example, estimated standard deviations of your estimator are based on large sample statistics, this means that you need enough clusters (independent observations) in order to obtain a &quot;good enough&quot; approximations for your standard deviations.</p>
<p>There is this &quot;old&quot; rule of thumb in statistics that large sample statistics start to &quot;work&quot; as soon as you have 30-40 independent observations. This however is an arbitrary number and there is not reason why you should stick to it. <strong>The general rule is: the more independent observations, the better</strong>.</p>
<p>If you are afraid that your data is not independent within your clusters, and if the number of clusters is not big enough, the best option would be to get more data. If that's not possible, I guess I would run the regression with and without clustered st-dev and report both.</p>

CC BY-SA 4.0
2021-06-12T09:30:23.987Z
2021-06-15T04:53:24.467Z
2021-06-15T04:53:24.467Z
tdm
<p>From this <a href="https://economics.stackexchange.com/a/36199/33142">discussion</a>, I deem that we need approximately <strong>40</strong> groups for clustering.</p>
<p>For example, if we want to clustered by <strong>industry</strong>, we need at least <strong>40 industries</strong>, or if we want to cluster by <strong>year</strong>, we need at least <strong>40 years</strong>. I am wondering if there is any reference or justification for this?</p>
<p>But in <a href="https://academic.oup.com/rfs/article/32/7/2587/5079300" rel="nofollow noreferrer">this paper, Table 11</a>, the author clustered a multi-way cluster (<strong>industry</strong> and <strong>year</strong>). However, their sample is from <strong>1990 to 2012</strong>, <strong>less than 40 year</strong>s, so how come they can do cluster by year in this case based on the above justification?</p>

<econometrics><applied-econometrics>
Why we need at least 40 groups to be properly clustered?
Phil Nguyen
# Why we need at least 40 groups to be properly clustered?

(Asked by: username_0 on 2021-06-12)

From this [discussion](https://economics.stackexchange.com/a/36199/33142), I deem that we need approximately **40** groups for clustering.

For example, if we want to clustered by **industry**, we need at least **40 industries**, or if we want to cluster by **year**, we need at least **40 years**. I am wondering if there is any reference or justification for this?

But in [this paper, Table 11](https://academic.oup.com/rfs/article/32/7/2587/5079300), the author clustered a multi-way cluster (**industry** and **year**). However, their sample is from **1990 to 2012**, **less than 40 year**s, so how come they can do cluster by year in this case based on the above justification?

**Tags:** econometrics, applied-econometrics

---

## 2 answers

### Answer by username_2 on 2021-06-12. Score: 6 | Accepted answer

First of all, clustering only changes the (estimated) standard deviations of your coefficients. Whether you cluster or not will not change the coefficients themselves and therefore also not the "true quality" of these estimates.

If you cluster, this means that you assume the observations within a given cluster are not independent. If this is true, then the true number of independent observations only equals the number of clusters. So if you have $N$ observations and $G$ clusters and if your data is not independent within each cluster, it is like you only have $G$ observations to work with.

Given that, for example, estimated standard deviations of your estimator are based on large sample statistics, this means that you need enough clusters (independent observations) in order to obtain a "good enough" approximations for your standard deviations.

There is this "old" rule of thumb in statistics that large sample statistics start to "work" as soon as you have 30-40 independent observations. This however is an arbitrary number and there is not reason why you should stick to it. **The general rule is: the more independent observations, the better**.

If you are afraid that your data is not independent within your clusters, and if the number of clusters is not big enough, the best option would be to get more data. If that's not possible, I guess I would run the regression with and without clustered st-dev and report both.


---

### Answer by username_1 on 2021-06-12. Score: 3

First, that is only a rule of thumb, exact number of clusters you need in any case is context dependent.

Second, actually as pointed out by [Cameron et al (2008)](https://direct.mit.edu/rest/article/90/3/414/57731/Bootstrap-Based-Improvements-for-Inference-with):

> A practical limitation of inference with cluster-robust
> standard errors is that the asymptotic justification assumes
> that the number of clusters goes to infinity.

Consequently, clustered standard errors only provide correct inference asymptotically. However, if you ever took any statistics class you might already know that the sufficiently large samples for asymptotic results to hold are typically samples with sample size of 30-40 observations. For example, for standard regression a *typically* a sufficient sample size to justify its asymptotic properties is 30 observations per independent regressors (see Verbeek A Guide to Modern Econometrics pp 36).

For a clustered errors a rule of thumb is 30-40 (clusters i.e. groups don't confuse this with observation count) although most authors go with the upper value of 40 or even Angrist and Pischke went for 42 (see MHE pp 319\*). Now the rule is arbitrary in the sense that of course every problem is unique and sometimes 29 or 31 clusters might be sufficient and sometimes you might need even 45 clusters (the other answer is correct in pointing out more is always better).

However, the number is not arbitrary in a sense its completely made up. The number of 30-40 cluster is actually based on examination of how different errors affect statistical inferences from Monte-Carlo simulations such as the one below (table taken from Cameron et al 2008).

You can see that as number of clusters increases the rejection rates (and their standard deviation) drops. Already with 30 clusters you can see that clustering errors are doing pretty well but depending on a setting more clusters might be needed still.

Minimum of 40 clusters is very reasonable rule of thumb for an applied econometrician. If you would want to get to exact number you would have to do some Monte-Carlo simulations for your problem and most likely you would find that the result is very close to the rule of thumb. Consequently, if you are willing to tolerate some (very) small possibility of having incorrect inference *minimum* of 40 clusters is reasonable rule of thumb (again more is of course even better). If you are willing to tolerate larger but still small possibility of having incorrect inference you can even use 30 as a rule of thumb.

[![enter image description here](https://i.sstatic.net/orZ9a.png)](https://i.sstatic.net/orZ9a.png)

\* Althought that was partially for the lolz since they constantly reference Douglas Adams The Hitchhiker's Guide to the Galaxy


---

