Skip to content

Tidy rewrite#9

Merged
bnaras merged 17 commits intomasterfrom
tidy-rewrite
Apr 8, 2026
Merged

Tidy rewrite#9
bnaras merged 17 commits intomasterfrom
tidy-rewrite

Conversation

@bnaras
Copy link
Copy Markdown
Owner

@bnaras bnaras commented Apr 8, 2026

Tidy version

bnaras added 17 commits April 6, 2026 19:29
- Add bcanon() function and documentation (nonparametric BCa)
- Bump version 0.2-3 -> 0.3
- Modernize package doc to use _PACKAGE sentinel
- Update RoxygenNote to 7.3.2
- Fix .Rbuildignore and .gitignore patterns
- Add CLAUDE.md with cleanup notes
- Add mathematical annotations with citations (Efron 1987, DiCiccio-Efron 1992, Efron-Narasimhan 2020)
- Unify return value structure: standardized lims columns (bca/jacksd/std/pct), stats columns (theta/sdboot/z0/a), always include call+seed
- Fix bcajack2(B=Blist) bug where m=nrow(x) evaluated eagerly
- Fix bcapar lims column ordering to match bcajack/bcajack2
- Eliminate dollar-sign partial matching in bcapar accessing bca() returns
- Rename cryptic variables: t.->jack_infl, ty.->reg_infl, ooo->bca_idx, vl->result, etc.
- Delete dead code: o1, Limsd, I=diag(p)
- Extract shared helpers: compute_bca_limits(), compute_kl_distance() in bca_core.R
- Modernize bcanon: replace rou/catj/sw with verbose/txtProgressBar, remove internal rounding
- Fix bcaplot: replace magic numbers with name-based row/column detection, remove partial matching
- Add m>n guard (else stop) in bcajack, bcajack2, bcanon
- Add singular covariance guard in abcpar
- Add mr unused-parameter warning in bcajack2
- R idiom sweep: seq_len/seq_along, numeric(), scale(center=TRUE,scale=FALSE)
- Add tinytest regression tests with baseline fixtures
- R CMD check --as-cran passes with Status: OK
Factor out duplicated code from bcajack, bcajack2, bcanon, bcapar:
- expand_alpha: alpha expansion pattern (was in all 4 functions)
- bootstrap_resample: bootstrap loop + count matrix (bcajack2/bcanon)
- jackknife_accel: classical delete-one/group jackknife (bcajack)
- regression_accel: KL-regression acceleration (bcajack2/bcanon qbca2)
- compute_ustats: bias-corrected estimator (bcajack/bcajack2)

All 14 regression tests pass with identical results.
- new_bcaboot(): canonical constructor with consistent structure
  (limits, stats, B_mean, ustats, method, accel, plus optional
  diagnostic/abc/conf_density/accel_matrix/sese)
- print.bcaboot(): formatted summary with confidence limits table
  and diagnostics instead of raw list dump
- Handles both old-style ($lims) and new-style ($limits) objects
  for smooth transition during rewrite
- bca_nonpar(): consolidated nonparametric BCa replacing bcajack/bcajack2/bcanon
  - accel="regression"|"jackknife" for acceleration method
  - conf.level instead of alpha (broom convention)
  - Descriptive parameter names (n_groups, kl_fraction, n_jack, etc.)
  - gbca diagnostic always computed for regression method
  - boot_data parameter instead of overloading B

- bca_par(): parametric BCa replacing bcapar
  - Same conf.level/parameter naming conventions
  - Remaps internal bca() return to canonical structure

- deprecated.R: lifecycle-based wrappers for bcajack, bcajack2, bcapar, bcaplot
  - Translate old parameter names to new API
  - Once-per-session deprecation warnings

- Removed: R/bcajack.R, R/bcajack2.R, R/bcanon.R, R/bcapar.R, R/bcaplot.R
  (logic migrated to new files + bca_core.R helpers)

- All new functions return canonical bcaboot objects via new_bcaboot()
  with consistent $limits (9x4), $stats (2x5), $B_mean, $ustats
- tidy.bcaboot(): returns tibble with one row per (conf.level, method)
  following broom conventions (conf.level, method, estimate, conf.low,
  conf.high, jacksd.low, jacksd.high)

- glance.bcaboot(): returns one-row tibble with method, accel, theta,
  sdboot, z0, a, sdjack, B, boot_mean

- autoplot.bcaboot(): ggplot2 visualization using tidy() output
  - Colored vertical segments for BCa intervals per coverage level
  - Grey dashed segments for standard intervals (offset to avoid overlap)
  - Red error bars for jackknife internal SE
  - Theta reference line with annotation
  - ggplot2 in Suggests: conditional s3_register in .onLoad (R/zzz.R)
- Bump version to 0.4.0
- Add tibble, generics, lifecycle to Imports
- Add ggplot2 to Suggests
- Export bca_nonpar, bca_par, tidy, glance
- Keep deprecated exports (bcajack, bcajack2, bcapar, bcaplot)

Tests: 34 (up from 14)
- Adapter tests proving numerical equivalence against old fixtures
  for all 4 original functions via the new API
- Structure tests: canonical return format (9x4 limits, 2x5 stats)
- tidy/glance output shape and column name tests
- autoplot returns ggplot object test

Fix: element_blank() -> ggplot2::element_blank() in autoplot
- NEWS.md: documents all breaking changes, deprecations, new features
- Vignette rewritten to use bca_nonpar/bca_par throughout
  - Demonstrates tidy(), glance(), autoplot() workflow
  - New "Migration from pre-1.0 API" section with function/parameter
    mapping tables and deprecation timeline
- Version bumped to 1.0 (lifecycle deprecation messages updated)
- README.Rmd/README.md: updated with logo, new API examples
  (bca_nonpar, tidy, autoplot), installation instructions
- Logo appears in pkgdown navbar and og:image metadata
- Regenerated full pkgdown site
@bnaras bnaras merged commit f4c5309 into master Apr 8, 2026
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