-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Hey Laurent,
I'm getting different p-values when using etable() versus wald() with clustered standard errors.
The problem is more severe with fewer clusters.
Example 1: Many clusters (base_did dataset)
data(base_did)
est_did = feols(y ~ x1 + i(period, treat, 5) | id + period,
cluster="id", base_did)
# IID case - they match
etable(est_did, keep="4", se="iid", coefstat="pvalue")
# Result: p-value = 0.1068
wald(est_did, c("4"), se="iid")
# Result: p-value = 0.1068
# Clustered case - small difference
etable(est_did, keep="4", cluster="id", coefstat="pvalue")
# Result: p-value = 0.1018
wald(est_did, c("4"), cluster="id")
# Result: p-value = 0.0992Example 2: Few clusters (iris dataset)
res = feols(Petal.Length ~ Petal.Width | Species, cluster="Species", iris)
# IID case - they match
etable(res, se="iid", coefstat="pvalue")
# Result: p-value = 4.41e-10
wald(res, c("Petal.Width"), se="iid")
# Result: p-value = 4.409e-10
# Clustered case - large difference
etable(res, cluster="Species", coefstat="pvalue")
# Result: p-value = 0.1405
wald(res, c("Petal.Width"))
# Result: p-value = 0.0187Summary:
- IID cases always match
- Clustered cases diverge, and the problem gets worse with fewer clusters
- In example 2 with only 3 clusters, the difference is dramatic (0.1405 vs 0.0187)
Is this a degrees-of-freedom issue in how clustering adjusts the test?
For the record:
R.Version()$version.string
[1] "R version 4.5.2 (2025-10-31 ucrt)"
packageVersion("fixest")
[1] '0.13.2'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels