Question
How can I use clustered standard errors in a t-test?
Asked by: USER4323
52 Viewed
52 Answers
Answer (52)
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'))`