jepusto / clubSandwich

Cluster-robust (sandwich) variance estimators with small-sample corrections
http://jepusto.github.io/clubSandwich/
47 stars 8 forks source link

Nested random effects - level of clustering in vcovCR #96

Closed leatamberg closed 2 months ago

leatamberg commented 3 months ago

Hi, thanks for the great package. I have a question regarding the clustering structure of the standard errors when applying vcovCR to a lmerMod object. When looking at get_outer_group, I get the impression that the only cluster level taken into account is the most coarse one in a model with nested random effects. However, with a closer look at the code, in some parts the more complex clustering seems to be taken into account.

Would one say that for a model with, say, country and country-year random effects, the standard errors computed by clubSandwich are clustered at the country level or at both levels? To me, this is not entirely clear from the documentation (my apologies if I have missed something).

Many thanks in advance!

jepusto commented 2 months ago

I think the clarity stems from the fact that "taken into account" can mean different things. Generally, cluster-robust SEs should always be clustered at the highest level of the hierarchy. The core assumption of CRVE is that the marginal errors for each cluster of observations are independent of the errors in other clusters, and you can think of RVE as “catching” all the dependence at any levels nested within the independent clusters. Thus, there is no need to also cluster at lower levels of the hierarchy. In your example, clustering at the country-level is sufficient.

CRVE will work even if your working model for the error structure (i.e., the distributional assumptions about the error structure in your lmerMod) is not correctly specified. So in that sense, CRVE does not need to take into account the lower-level structure. However, the small-sample adjustments implemented in clubSandwich--specifically the CR2 and CR3 corrections--use the estimated working model to make refinements to the basic CRVE. Thus, they do need to take into account the full structure of the lmerMod (including the lower-level structure)--but only for purposes of small-sample refinement. They are still helpful even if the working model isn't entirely correct.

leatamberg commented 1 month ago

Thank you so much, very helpful!