Conversation
Added badges for CI status in README
There was a problem hiding this comment.
Pull request overview
This PR focuses on improving the csdm package’s user-facing documentation by expanding roxygen docs, regenerating Rd files, and adding a more comprehensive introductory vignette/README narrative. It also updates build configuration to enable roxygen markdown.
Changes:
- Expanded roxygen documentation for core APIs (
csdm(), S3 methods, residual/CD utilities) and regeneratedman/*.Rd. - Replaced older vignette stubs with a new
introduction_to_csdmvignette and substantially expanded the README content. - Enabled roxygen markdown via
DESCRIPTION.
Reviewed changes
Copilot reviewed 20 out of 25 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| vignettes/xtdcce2-mapping.Rmd | Removed existing vignette content (mapping-focused). |
| vignettes/introduction_to_csdm.Rmd | Added new long-form intro vignette with estimator/CD-test explanations and runnable examples. |
| vignettes/introduction.Rmd | Removed old minimal vignette stub. |
| README.md | Replaced short README with a much longer methodology + usage overview. |
| R/csdm.R | Expanded csdm() roxygen docs (equations, assumptions, examples, references). |
| R/csdm_methods.R | Added/expanded roxygen docs for print/summary/coef/vcov/residuals/predict S3 methods. |
| R/utils_cd.R | Rewrote cd_test() roxygen docs and examples. |
| R/utils_residuals.R | Expanded docs/examples for get_residuals() and prepare_cd_input(). |
| DESCRIPTION | Enabled roxygen markdown (Roxygen: list(markdown = TRUE)). |
| man/csdm.Rd | Regenerated/expanded csdm() Rd docs. |
| man/summary.csdm_fit.Rd | Regenerated/expanded summary Rd docs + examples. |
| man/print.summary.csdm_fit.Rd | Regenerated/expanded print.summary Rd docs. |
| man/print.csdm_fit.Rd | Added Rd for print.csdm_fit(). |
| man/coef.csdm_fit.Rd | Added Rd for coef.csdm_fit(). |
| man/vcov.csdm_fit.Rd | Added Rd for vcov.csdm_fit(). |
| man/residuals.csdm_fit.Rd | Added Rd for residuals.csdm_fit(). |
| man/predict.csdm_fit.Rd | Added Rd for predict.csdm_fit(). |
| man/cd_test.Rd | Regenerated/expanded cd_test() Rd docs + examples. |
| man/get_residuals.Rd | Regenerated/expanded residual accessor docs + examples. |
| man/prepare_cd_input.Rd | Regenerated/expanded preprocessing helper docs + examples. |
| man/cross_sectional_avg.Rd | Minor formatting/regeneration changes. |
| man/pooled_vcov.Rd | Minor formatting/regeneration changes. |
| man/cluster_vcov.Rd | Minor formatting/regeneration changes. |
| man/PWT_60_07.Rd | Minor formatting/regeneration changes. |
| renv.lock | Updated lockfile contents (package set/version changes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #' @param model Estimator to fit. One of \code{"mg"}, \code{"cce"}, | ||
| #' \code{"dcce"}, or \code{"cs_ardl"}. |
There was a problem hiding this comment.
The model parameter docs list only "mg", "cce", "dcce", and "cs_ardl", but the function signature allows additional values (cs_ecm, cs_dl) that currently error with "Not implemented yet". Please either document these as reserved/unimplemented options or remove them from match.arg() choices until they’re supported to avoid surprising API behavior.
| # MG: Separate regression per country, then average coefficients | ||
| fit_mg <- csdm( | ||
| log_rgdpo ~ log_hc + log_ck + log_ngd, | ||
| data = df, | ||
| id = "id", | ||
| id = "id", |
There was a problem hiding this comment.
The README examples use data = df but df is never created in this file (no data(PWT_60_07, ...) / df <- ... setup). As written, these examples won’t run when copied. Consider adding a short setup snippet (e.g., library(csdm); data(PWT_60_07, package="csdm"); df <- PWT_60_07 or a small subset) before the first model fit.
| $$CD = \sqrt{\frac{2}{N(N-1)}} \sum_{i=1}^{N-1} \sum_{j=i+1}^{N} \hat{\rho}_{ij} \sqrt{T}$$ | ||
|
|
||
| where $\hat{\rho}_{ij}$ is the cross-sectional correlation between residuals of units $i$ and $j$. The test statistic is approximately standard normal under the null. |
There was a problem hiding this comment.
The CD formula here uses a common ���\sqrt{T} factor, but cd_test() (see R/utils_cd.R) uses \sqrt{T_{ij}} (pairwise overlap) to support unbalanced panels. The README should match the implemented statistic (or explicitly state it assumes a balanced panel).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request provides a comprehensive overhaul and significant enhancement of the documentation for the
csdmpackage, focusing on improving clarity, completeness, and usability for both end users and developers. The changes include expanded and more detailed Roxygen docstrings for all major user-facing functions, including the main estimator, summary and print methods, coefficient extraction, residual handling, prediction, and cross-sectional dependence (CD) diagnostics. Additionally, theDESCRIPTIONfile is updated to enable markdown support for documentation.The most important changes are:
Expanded and Improved Documentation for Main Estimator and Methods:
R/csdm.R: The maincsdm()function documentation is extensively rewritten to provide detailed descriptions of supported estimators (MG, CCE, DCCE, CS-ARDL), their equations, assumptions, identification strategies, and references. The examples are expanded to show usage for all major model types.R/csdm_methods.R: All S3 methods (print,summary,coef,vcov,residuals,predict) forcsdm_fitobjects now have much more comprehensive docstrings, including detailed explanations of returned values, usage, and examples. [1] [2] [3] [4] [5] [6]Documentation and Usability Improvements for Diagnostics and Utilities:
R/utils_cd.R: The documentation forcd_test()is rewritten to clarify its purpose, usage, test statistics, handling of missing data, and references. The examples now demonstrate its use both with matrices and fitted models. [1] [2]R/utils_residuals.R: The documentation forget_residuals()and related utilities is expanded to explain residual types, assumptions, usage, and provide runnable examples. [1] [2] [3]Package-level and Build Configuration:
DESCRIPTION: AddsRoxygen: list(markdown = TRUE)to enable markdown formatting in documentation throughout the package.These changes greatly improve the clarity, accessibility, and professionalism of the package documentation, making it easier for users to understand the estimators, interpret results, and utilize diagnostic tools.