Skip to content

Conversation

@s3alfisc
Copy link
Member

Core things to remember:

  • For G.adj, use the number of unique time units
  • "nonnested" is not relevant

Some R code to replicate fixest behavior:

library(fixest)

set.seed(123)
n_id <- 100        
n_time <- 10      
id <- rep(1:n_id, each = n_time)
time <- rep(1:n_time, times = n_id)
x1 <- rnorm(n_id * n_time)
x2 <- runif(n_id * n_time, 0, 10)
individual_fe <- rnorm(n_id)
time_fe <- rnorm(n_time)
y <- 1 + 0.5 * x1 - 0.3 * x2 + individual_fe[id] + time_fe[time] + rnorm(n_id * n_time)
panel_data <- data.frame(id = id, time = time, x1 = x1, x2 = x2, y = y)
head(panel_data)

panel_unit1 = panel_data[panel_data$id == 1,]

fit = feols(y ~ x1 | id + time, data = panel_data)

fit1 = feols(y ~ x1, data = panel_unit1)

a = vcov_NW(fit, lag = 4, time = ~ time, unit = ~ id, ssc = ssc(K.adj = TRUE, G.adj = FALSE, K.fixef = "none"))
b = vcov_NW(fit, lag = 4, time = ~ time, unit = ~ id, ssc = ssc(K.adj = TRUE, G.adj = FALSE, K.fixef = "nonnested"))
c = vcov_NW(fit, lag = 4, time = ~ time, unit = ~ id, ssc = ssc(K.adj = TRUE, G.adj = FALSE, K.fixef = "full"))

a / b
#            (Intercept) x1
#(Intercept)           1  1
#x1                    1  1
a / c
#            (Intercept) x1
#(Intercept)           1  1
#x1                    1  1

b / c

Note: G.adjarg is applied, inconsistent with new hetero behavior. See here lrberge/fixest#611 (comment)

damandhaliwal and others added 30 commits August 26, 2025 21:38
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
core-tests 76.32% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pyfixest/estimation/feols_.py 85.28% <100.00%> (-0.24%) ⬇️
pyfixest/utils/utils.py 87.14% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@s3alfisc s3alfisc merged commit 2fb76b3 into master Oct 19, 2025
6 of 9 checks passed
@s3alfisc s3alfisc deleted the ssc-hac branch October 19, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants