# NOT RUN {
# We create "irregular" FEs
base = data.frame(x = rnorm(10))
base$y = base$x + rnorm(10)
base$fe1 = rep(1:3, c(4, 3, 3))
base$fe2 = rep(1:5, each = 2)
est = feols(y ~ x | fe1 + fe2, base)
# fe1: 3 FEs
# fe2: 5 FEs
#
# Clustered standard-errors: by fe1
#
# Default: fixef = "nested"
# => adjustment K = 1 + 5 (i.e. x + fe2)
summary(est)
attributes(vcov(est))[c("dof.type", "dof.K")]
# fixef = FALSE
# => adjustment K = 1 (i.e. only x)
summary(est, dof = dof(fixef=FALSE))
attr(vcov(est, dof = dof(fixef=FALSE)), "dof.K")
# fixef = TRUE
# => adjustment K = 1 + 3 + 5 - 1 (i.e. x + fe1 + fe2 - 1 restriction)
summary(est, dof = dof(fixef=TRUE))
attr(vcov(est, dof = dof(fixef=TRUE)), "dof.K")
# fixef = TRUE & exact = TRUE
# => adjustment K = 1 + 3 + 5 - 2 (i.e. x + fe1 + fe2 - 2 restrictions)
summary(est, dof = dof(fixef=TRUE, exact = TRUE))
attr(vcov(est, dof = dof(fixef=TRUE, exact = TRUE)), "dof.K")
# There are two restrictions:
attr(fixef(est), "references")
# }
Run the code above in your browser using DataLab