Skip to content

Enhance docs#8

Merged
Macosso merged 15 commits intomasterfrom
enhance_docs
Feb 17, 2026
Merged

Enhance docs#8
Macosso merged 15 commits intomasterfrom
enhance_docs

Conversation

@Macosso
Copy link
Copy Markdown
Owner

@Macosso Macosso commented Feb 17, 2026

This pull request provides a comprehensive overhaul and significant enhancement of the documentation for the csdm package, 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, the DESCRIPTION file 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 main csdm() 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) for csdm_fit objects 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 for cd_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 for get_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: Adds Roxygen: 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 regenerated man/*.Rd.
  • Replaced older vignette stubs with a new introduction_to_csdm vignette 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.

Comment on lines +17 to +18
#' @param model Estimator to fit. One of \code{"mg"}, \code{"cce"},
#' \code{"dcce"}, or \code{"cs_ardl"}.
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +105
# 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",
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +187 to +189
$$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.
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Macosso and others added 7 commits February 17, 2026 19:58
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>
@Macosso Macosso merged commit 7a20a42 into master Feb 17, 2026
1 check passed
@Macosso Macosso deleted the enhance_docs branch February 26, 2026 08:13
@Macosso Macosso restored the enhance_docs branch February 26, 2026 08:13
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