0
$\begingroup$

I am relatively new to Statistics and R, so please forgive my naive question. I have clustered school data and would like to employ matching followed by a regression. In the paper I read ("Matching Methods for Clustered Observationsl Studies in Education" by Keele et. al) it was recommended to account for both with-in school correlations and pair-wise correlations (from matching) with robust standard errors or random effects.

As I am not familiar with random effects and only know how to use robust standard errors on one level, how would I use robust standard errors for both levels (with-in school correlations and pair-wise correlations) in R?

$\endgroup$
1
  • 2
    $\begingroup$ Was the matching done prior to sampling, or are you discarding sampled data by incorporating matching? If the latter please rethink. Matching is a highly ineffective approach when it involves either (1) any arbitrariness in the choice of matching algorithm or (2) discarding valid observations. For more see this. $\endgroup$ Commented Jul 28, 2021 at 12:41

1 Answer 1

1
$\begingroup$

In R this is simple. Using the sandwich package, which is the package used for robust standard errors, you can simply run the following:

library(sandwich); library(lmtest)
fit <- lm(Y ~ treat, data = matched_data)
coeftest(fit, vcov. = vcovCL, cluster = ~subclass + school)

The assumes matched_data contains the results of your matching and has a column called subclass containing pair membership (e.g., as the output of a call to match.data() after MatchIt::matchit()) and school the name of the school variable. This performs multi-way clustering, accounting for both types of clustering, which is explained in the vignette for the sandwich package.

$\endgroup$
1
  • $\begingroup$ Thank you Noah, that was exactly what I was looking for. $\endgroup$
    – vun
    Commented Jul 28, 2021 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.