[ENH] Add Pesaran CD panel dependence diagnostic#703
Open
hass-nation wants to merge 1 commit into
Open
Conversation
Add a cached pesaran_cd result property for panel estimators, backed by idiosyncratic residual correlations and a standard-normal test container, with balanced and unbalanced coverage in the panel and shared hypothesis tests. Implements the diagnostic in Pesaran, M. H. (2021), "General diagnostic tests for cross-sectional dependence in panels", Empirical Economics, 60(1), 13-50. Co-Authored-By: OpenAI Codex <codex@openai.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #703 +/- ##
==========================================
- Coverage 99.54% 99.52% -0.03%
==========================================
Files 101 101
Lines 17426 17524 +98
Branches 1430 1435 +5
==========================================
+ Hits 17347 17440 +93
- Misses 29 31 +2
- Partials 50 53 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ 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.
Summary
pesaran_cdcached result property to panel model resultsMotivation
Pesaran's CD test is a widely used panel diagnostic for residual cross-sectional dependence, especially when users want a quick dependence check after fitting pooled, fixed-effects, or random-effects models.
linearmodelsalready exposes panel result diagnostics and residual accessors, so this test fits naturally in the existing results API.Reference
Validation
python -m pytest linearmodels/tests/shared/test_utility.py linearmodels/tests/panel/test_results.pypython -m pytest linearmodels/tests/panel/test_pooled_ols.py::test_results_access linearmodels/tests/panel/test_panel_ols.py::test_results_access linearmodels/tests/panel/test_between_ols.py::test_results_access linearmodels/tests/panel/test_random_effects.py::test_results_access linearmodels/tests/panel/test_firstdifference_ols.py::test_results_access linearmodels/tests/panel/test_fama_macbeth.py::test_fama_macbeth linearmodels/tests/panel/test_fama_macbeth.py::test_fama_macbeth_kernel_smokepython -m ruff check linearmodels/shared/hypotheses.py linearmodels/panel/results.py linearmodels/tests/shared/test_utility.py linearmodels/tests/panel/test_results.py