I have a panel data that follows the same individuals (id
) over 2 time periods being 2002 and 2004 (year
where year
equals to 1 if the year is 2004).
N = 10000
wage <- rnorm(N)
educ <- rnorm(N)
age <- rnorm(N)
tce <- rnorm(N)
work <- rbinom(n = N, size = 1, prob = 0.05)
manu <- rbinom(n = N, size = 1, prob = 0.05)
year <- rbinom(n = N, size = 1, prob = 0.05)
id <- sample(10, N, replace = TRUE)
df <- data.frame(wage, educ, age, tce, work, manu, id, year)
I would like advice on how to cluster standard errors, if I wanted to cluster standard errors at the individual level. Should it be:
library(fixest)
model1 <- feols(wage ~ educ + age + tce, data = df, vcov = id)
or is it
library(fixest)
model2 <- feols(wage ~ educ + age + tce, data = df, vcov = ~id+year)
since I have panel data.
Thank you.