Skip to content

Feature/cd enhancement - #14

Open
Macosso wants to merge 10 commits into
masterfrom
feature/cd_enhancement
Open

Macosso wants to merge 10 commits into
masterfrom
feature/cd_enhancement

Conversation

@Macosso

@Macosso Macosso commented Oct 7, 2026

Copy link
Copy Markdown
Owner

This pull request adds major new features and improvements to the cross-sectional dependence diagnostics in the csdm package. The most significant update is the extension of the cd_test() function to support direct testing of panel variables from data.frame and pdata.frame objects, not just residuals or fitted models. The update also introduces a reps parameter for repeated randomization in CDw/CDw+ tests, improves reporting of excluded time periods, and provides clearer documentation and print output.

New and extended methods for panel variable testing:

  • Added cd_test() methods for data.frame and pdata.frame objects, allowing users to select numeric panel variables explicitly via ... (bare names, quoted names, or character vectors). These methods require explicit id and time columns for plain data frames and use stored indexes for pdata.frame. The results are returned as a named list (cd_test_list), with one result per variable, and print as a combined table with sample dimensions. [1] [2] [3] [4]

Enhancements to CDw and CDw+ tests:

  • Introduced a reps argument to CDw and CDw+ tests, allowing multiple independent random weight draws (default 1). The statistics are combined according to equation (33) of Juodis and Reese, and the number of draws is recorded in the output. Seeded calls now apply the seed separately to each variable's test. [1] [2] [3] [4] [5] [6]

Improved reporting and print output:

  • The print method for cd_test_list now displays a combined table of results by variable, including test statistics, p-values, and sample dimensions. [1] [2]

Handling of incomplete time periods:

  • The function now records incomplete time periods removed by drop.incomplete.times in an excluded_times field, alongside periods with no finite observations, for more transparent reporting. [1] [2] [3]

Documentation and usage examples:

  • Expanded documentation in both Roxygen and README.md to reflect the new methods, argument details, and usage examples for variable selection and repeated randomization. [1] [2] [3] [4] [5] [6]

These changes make the cross-sectional dependence diagnostics more flexible, user-friendly, and informative for a wider range of panel data workflows.

@codecov-commenter

codecov-commenter commented Oct 7, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 94.54545% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.91%. Comparing base (e562783) to head (fa9085a).

Files with missing lines Patch % Lines
R/utils_cd.R 89.18% 8 Missing ⚠️
R/utils_cd_data.R 98.90% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #14      +/-   ##
==========================================
+ Coverage   82.93%   84.91%   +1.98%     
==========================================
  Files          16       17       +1     
  Lines        1365     1518     +153     
==========================================
+ Hits         1132     1289     +157     
+ Misses        233      229       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

2 participants