0

I would like to cluster errors in my fixed effect regression at the origin-by-year level. When I use : (i.e., year:origin) as clusters in the felm formula, it seems like felm actually clusters error in a two-way manner (i.e., year + origin). When I create a separate variable that indicates the origin-by-year level and use it for the error clustering, it seems to work properly.

My question is, does the ':' operator not work in the felm cluster? Or it is supposed to work, but are there some errors from my end or from the package itself?

pacman::p_load(dplyr, lfe, ISLR)

Auto = Auto

Auto %<>% mutate(year_origin = paste0(year, '_', origin))

felm(mpg ~ weight | year + origin | 0 | year + origin, data = Auto) %>% tidy()
felm(mpg ~ weight | year + origin | 0 | year:origin, data = Auto) %>% tidy()
felm(mpg ~ weight | year + origin | 0 | year_origin, data = Auto) %>% tidy()

0 Answers0