Repository navigation
Fix some discrepancies with reghdfe/ivreghdfe - #286
Merged
eloualiche merged 4 commits intoNov 2, 2026
Merged
Conversation
- Do not count fixed-effect levels that are redundant across fixed effects - Count fixed effects nested in a cluster only once, for the constant - Use the first-stage degrees of freedom in F_kp when over-identified - Require Vcov 0.8.4 and bump version to 2.2.0
matthieugomez
force-pushed
the
first-stage-and-dof-parity
branch
from
October 30, 2026 14:18
87e37a2 to
546e8b3
Compare
- Do not drop regressors or the constant because of the units of another regressor - Do not drop regressors as collinear with fixed effects because of their mean - Estimate models with a constant in deviations from the means - Count slopes nested in a cluster in the degrees of freedom - Test only linearly independent coefficients in the F-statistic - Fix adjr2 with slope fixed effects and no constant - Require Vcov 0.8.5
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #286 +/- ##
=======================================
Coverage ? 96.47%
=======================================
Files ? 9
Lines ? 937
Branches ? 0
=======================================
Hits ? 904
Misses ? 33
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes discrepancies with reghdfe and bumps the version to 2.2.0.
Changes correcting degrees of freedom and test statistics:
fe(State) + fe(Year)on the Cigar data), and each fixed effect nested in a cluster added exactly one degree of freedom, while reghdfe counts the constant only once and slopes in full. This changesdof_fes,dof_residual, standard errors, the F-statistic, and adjusted R².adjr2: it usedn - 1with slope fixed effects and no constant instead ofn.F_kpwhen over-identified: the correction counted the second-stage regressors, but the residuals come from the first stage, which has one regressor per instrument.Changes to better handle collinearity:
yearin a panel of five years, or a date, was dropped as collinear withfe(id). The test now compares what remains after absorbing the fixed effects to the variation around the mean, up to the accuracy of the solver.The fix requires FixedEffects 3.4.1, because the count of redundant levels uses
FixedEffects.components. It also requires Vcov 0.8.5 (FixedEffects/Vcov.jl#31).