How can I use clustered standard errors in a t-test?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I use clustered standard errors in a t-test?
Asked by:
52 Viewed 52 Answers

Answer (52)

Best Answer
(311)
After calculating the clustered variance-covariance matrix using `vcovHC()`, you can use it with the `t.test()` function. Pass the `cluster` argument to `t.test()` to specify the clustering variable. For example: `t.test(dependent_variable ~ independent_variable, vcov = vcovHC(model, cluster = 'classroom'))`