Skip to content

Add testthat coverage and finalize docs for empirical RIR#126

Open
JihoonChoi26 wants to merge 15 commits into
masterfrom
dev-tests
Open

Add testthat coverage and finalize docs for empirical RIR#126
JihoonChoi26 wants to merge 15 commits into
masterfrom
dev-tests

Conversation

@JihoonChoi26

@JihoonChoi26 JihoonChoi26 commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Three changes. The first two address Josh's feedback on missing test
coverage and doc quality. The third is a new master-only function, not
part of the CRAN release.

Tests:

  • test-corr-rir.R: 5 tests for test_correlation_rir()
  • test-empirical-rir.R: 9 tests for the empirical RIR pipeline

Docs:

  • konfound_empdist() promoted to public export; @Keywords internal
    removed, full @description and \donttest{} example added

Master-only (not for CRAN):

  • robust_attrition() added for differential attrition robustness (beta).
    Standalone export in R/test_attrition.R, held back from the public release.
  • test-robust-attrition.R: 5 tests for robust_attrition()

All tests pass (0 errors, 0 warnings on devtools::check()).

tests/testthat/test-corr-rir.R
  5 tests covering test_correlation_rir(): canonical t-scale numeric
  crosscheck, non-significant sustain branch, r-scale vs t-scale
  divergence, GLM gate (scale="t" blocked), and GLM smoke test.

tests/testthat/test-empirical-rir.R
  9 tests covering the empirical RIR pipeline: refit_like() coefficient
  identity, prep_empirical_rir() vector dimensions and error on missing
  model frame, label_cases() ci_share normalization and factor structure,
  find_k_star() bounded output, and konfound_empdist() class contract,
  seed reproducibility, and non-significant error guard.
Removes @Keywords internal from konfound_empdist(), making it a fully
documented public export consistent with its @export tag.
@JihoonChoi26 JihoonChoi26 requested a review from jrosen48 April 1, 2026 02:24
@JihoonChoi26

Copy link
Copy Markdown
Collaborator Author

Hi Josh! a few more updates are coming to this PR based on recent discussion with Dr. Frank, mainly around the RIR printed output. Will push those shortly and ping you when it's ready for a review. Thanks!

- New exported function robust_attrition() (beta) in R/robust_attrition.R
- Argument names aligned with pkonfound family (std_err, n_covariates)
- Tests in tests/testthat/test-robust-attrition.R
- Additional update in test_corr_RIR.R output dispatch
Add robust_attrition in it
update input validation part
VAM print output update with linebreak, citation added
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.

1 participant