From 647b08b8e716ec578045bfa4bb5b930a38527024 Mon Sep 17 00:00:00 2001
From: Balasubramanian Narasimhan _Dsc;IMjB|GAIl)MUR$p$yytzVsQ)(bx}jR(l)@Do!;dm
z{6abj=`wHO^_9l*{O;6DNlvzjK?flWwNhl573O4BQJtaDFGF$j5u!?p+E2I4DNm+Z
zFfcJSOeGRI4CIZF*VSyL{xk1GPlx@pqbC%Fbhr9Dd?Ia7$AjbHhh(@DEWzotZ*Aq|
zbSgX9J0nkh9J)AF2;}&j;Z`oEFeDs)I(!qLj&c7)W$k2zJdNt?AJwBV_aK=60pjoQ
IUE>Y_00PsqN&o-=
diff --git a/inst/tinytest/test_regression.R b/inst/tinytest/test_regression.R
index 9942090..de1e69e 100644
--- a/inst/tinytest/test_regression.R
+++ b/inst/tinytest/test_regression.R
@@ -29,9 +29,9 @@ cur <- bca_nonpar(x = Xy, B = 1000, func = rfun,
verbose = FALSE)
## BCa and std limits must match exactly
-expect_equal(cur$limits[, "bca"], ref$lims[, "bca"], tolerance = tol,
+expect_equal(cur$limits[, "bca"], ref$limits[, "bca"], tolerance = tol,
info = "bcajack equiv: bca limits match")
-expect_equal(cur$limits[, "std"], ref$lims[, "std"], tolerance = tol,
+expect_equal(cur$limits[, "std"], ref$limits[, "std"], tolerance = tol,
info = "bcajack equiv: std limits match")
## Stats estimate row must match
expect_equal(unname(cur$stats["est", ]), unname(ref$stats["est", ]),
From 31789441f801f6d7d0d83e292c8c34054a854b94 Mon Sep 17 00:00:00 2001
From: Balasubramanian Narasimhan A Nonparametric ExampleThe
result prints a clean summary:
result## BCa Bootstrap Confidence Intervals
-## Method: nonpar (regression acceleration)
-## B = 2000, theta = 0.5065603, sdboot = 0.03245877
-##
-## Confidence limits:
-## conf.level bca.lo bca.hi std.lo std.hi
+## conf.level bca.lo bca.hi std.lo std.hi
## 0.95 0.4221740 0.5613841 0.4429423 0.5701783
## 0.90 0.4392968 0.5507219 0.4531704 0.5599503
## 0.80 0.4541906 0.5387434 0.4649627 0.5481579
-## 0.68 0.4647324 0.5298461 0.4742814 0.5388392
-##
-## Diagnostics:
-## z0 = -0.2676094, a = -0.005846673, sdjack = 0.03232833
+## 0.68 0.4647324 0.5298461 0.4742814 0.5388392
glm_bca## BCa Bootstrap Confidence Intervals
-## Method: par
-## B = 2000, theta = 0.9430645, sdboot = 0.1549141
-##
-## Confidence limits:
-## conf.level bca.lo bca.hi std.lo std.hi
+## conf.level bca.lo bca.hi std.lo std.hi
## 0.95 0.5981733 1.213676 0.6394385 1.246691
## 0.90 0.6549470 1.167789 0.6882535 1.197876
## 0.80 0.7169529 1.113660 0.7445341 1.141595
-## 0.68 0.7635391 1.067160 0.7890090 1.097120
-##
-## Diagnostics:
-## z0 = -0.2147016, a = -0.01940269
+## 0.68 0.7635391 1.067160 0.7890090 1.097120
tidy(glm_bca)diff --git a/docs/reference/bcajack2.md b/docs/reference/bcajack2.md index 020163a..b804414 100644 --- a/docs/reference/bcajack2.md +++ b/docs/reference/bcajack2.md @@ -148,9 +148,10 @@ set.seed(1234) bcajack2(x = Xy, B = 1000, func = rfun, m = 40, verbose = FALSE) #> Warning: `bcajack2()` was deprecated in bcaboot 1.0. #> ℹ Please use `bca_nonpar()` instead. -#> BCa Bootstrap Confidence Intervals -#> Method: nonpar (regression acceleration) -#> B = 1000, theta = 0.5065603, sdboot = 0.03076788 +#> +#> ── BCa Bootstrap Confidence Intervals +#> Method: nonpar (regression acceleration) +#> B = 1000, theta = 0.5065603, sdboot = 0.03076788 #> #> Confidence limits: #> conf.level bca.lo bca.hi std.lo std.hi @@ -160,5 +161,5 @@ bcajack2(x = Xy, B = 1000, func = rfun, m = 40, verbose = FALSE) #> 0.68 0.4621266 0.5255210 0.4759630 0.5371577 #> #> Diagnostics: -#> z0 = -0.3853205, a = -0.01094242, sdjack = 0.03139928 +#> z0 = -0.3853205, a = -0.01094242, sdjack = 0.03139928 ``` diff --git a/docs/reference/bcapar.html b/docs/reference/bcapar.html index 365fb41..b63a19b 100644 --- a/docs/reference/bcapar.html +++ b/docs/reference/bcapar.html @@ -162,19 +162,20 @@## # A tibble: 8 × 7 diff --git a/docs/articles/bcaboot.md b/docs/articles/bcaboot.md index 23d5ab8..2c9869e 100644 --- a/docs/articles/bcaboot.md +++ b/docs/articles/bcaboot.md @@ -65,19 +65,11 @@ The `result` prints a clean summary: result ``` - ## BCa Bootstrap Confidence Intervals - ## Method: nonpar (regression acceleration) - ## B = 2000, theta = 0.5065603, sdboot = 0.03245877 - ## - ## Confidence limits: ## conf.level bca.lo bca.hi std.lo std.hi ## 0.95 0.4221740 0.5613841 0.4429423 0.5701783 ## 0.90 0.4392968 0.5507219 0.4531704 0.5599503 ## 0.80 0.4541906 0.5387434 0.4649627 0.5481579 ## 0.68 0.4647324 0.5298461 0.4742814 0.5388392 - ## - ## Diagnostics: - ## z0 = -0.2676094, a = -0.005846673, sdjack = 0.03232833 ### Tidy output @@ -147,13 +139,13 @@ tidy(result_jk) ## # A tibble: 8 × 7 ## conf.level method estimate conf.low conf.high jacksd.low jacksd.high ##,- ## 1 0.95 bca 0.507 0.435 0.560 0.00397 0.00195 + ## 1 0.95 bca 0.507 0.435 0.560 0.00412 0.00155 ## 2 0.95 standard 0.507 0.443 0.570 NA NA - ## 3 0.9 bca 0.507 0.443 0.551 0.00564 0.00279 + ## 3 0.9 bca 0.507 0.443 0.551 0.00497 0.00224 ## 4 0.9 standard 0.507 0.453 0.560 NA NA - ## 5 0.8 bca 0.507 0.454 0.540 0.00162 0.00205 + ## 5 0.8 bca 0.507 0.454 0.540 0.00127 0.00158 ## 6 0.8 standard 0.507 0.465 0.548 NA NA - ## 7 0.68 bca 0.507 0.464 0.531 0.00213 0.00204 + ## 7 0.68 bca 0.507 0.464 0.531 0.00186 0.00177 ## 8 0.68 standard 0.507 0.474 0.539 NA NA ## A Parametric Example @@ -269,19 +261,11 @@ We can examine the results using tidy methods: glm_bca ``` - ## BCa Bootstrap Confidence Intervals - ## Method: par - ## B = 2000, theta = 0.9430645, sdboot = 0.1549141 - ## - ## Confidence limits: ## conf.level bca.lo bca.hi std.lo std.hi ## 0.95 0.5981733 1.213676 0.6394385 1.246691 ## 0.90 0.6549470 1.167789 0.6882535 1.197876 ## 0.80 0.7169529 1.113660 0.7445341 1.141595 ## 0.68 0.7635391 1.067160 0.7890090 1.097120 - ## - ## Diagnostics: - ## z0 = -0.2147016, a = -0.01940269 ``` r diff --git a/docs/news/index.html b/docs/news/index.html index 6241032..53d05bf 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -48,16 +48,24 @@ Deprecationsbcajack()
bcajack2(),bcapar(), andbcaplot()are deprecated withlifecyclewarnings (once per session). They will continue to work through thin wrappers that translate to the new API.++Bug fixes
+
- +
Issue #2: Fixed grouped jackknife (
n_groups < n) usingsapply(seq_len_m, sample.int, ...)which accidentally passed iteration values as the first positional arg, overriding then=keyword and enabling replacement. Replaced withmatrix(sample.int(n, n-r), nrow=m)for correct without-replacement partition. (Reported by admash)- +
Issue #7: Fixed dimension drop when
xis a single-column matrix (vector input).x[-i, ]on ann x 1matrix returned a vector instead of a matrix, causing type inconsistency between jackknife and bootstrap code paths. Addeddrop = FALSEto all matrix subsetting passed tofunc. (Reported by R180)- +
Issue #4 / #1:
regression_accelnow checks for underdetermined regression (nearby samples < ncol(Y)) and errors with an actionable message instead of silently returning NAs. Suggests increasingB, increasingkl_fraction, or switching toaccel = "jackknife". (Reported by Tim Pollington, Thomas Covert)- +
PR #8: Fixed missing
return()inK = 0early-exit path ofbcajack(),bcajack2(), andbcapar(), which caused execution to fall through to theK > 0code. In the rewrite, all early exits use explicitreturn(new_bcaboot(...)). (Reported by Bettina Gruen)New features
tidy()method: returns a tibble with one row per (confidence level, method) pair, following broom conventions (conf.level,method,estimate,conf.low,conf.high).
glance()method: returns a one-row tibble summarizing the bootstrap run (method,accel,theta,sdboot,z0,a,sdjack,B,boot_mean).
autoplot()method: ggplot2 visualization of BCa vs standard confidence intervals. Requires ggplot2 (in Suggests).Improved
print(): formatted summary with confidence limits table instead of raw list dump.- +
bca_nonpar()always computes the gbca diagnostic when usingaccel = "regression"(withtryCatchfor robustness).All user-facing messages use
clifor consistent formatting.Dependencies
-
- Added
+tibble,generics,lifecycleto Imports.
- Added
cli,tibble,generics,lifecycleto Imports.- Added
ggplot2to Suggests (forautoplot()).diff --git a/docs/news/index.md b/docs/news/index.md index 9d05461..b3b4f28 100644 --- a/docs/news/index.md +++ b/docs/news/index.md @@ -35,6 +35,39 @@ warnings (once per session). They will continue to work through thin wrappers that translate to the new API. +### Bug fixes + +- **Issue [\#2](https://github.com/bnaras/bcaboot/issues/2)**: Fixed + grouped jackknife (`n_groups < n`) using + `sapply(seq_len_m, sample.int, ...)` which accidentally passed + iteration values as the first positional arg, overriding the `n=` + keyword and enabling replacement. Replaced with + `matrix(sample.int(n, n-r), nrow=m)` for correct without-replacement + partition. (Reported by admash) + +- **Issue [\#7](https://github.com/bnaras/bcaboot/issues/7)**: Fixed + dimension drop when `x` is a single-column matrix (vector input). + `x[-i, ]` on an `n x 1` matrix returned a vector instead of a matrix, + causing type inconsistency between jackknife and bootstrap code paths. + Added `drop = FALSE` to all matrix subsetting passed to `func`. + (Reported by R180) + +- **Issue [\#4](https://github.com/bnaras/bcaboot/issues/4) / + [\#1](https://github.com/bnaras/bcaboot/issues/1)**: + `regression_accel` now checks for underdetermined regression + (`nearby samples < ncol(Y)`) and errors with an actionable message + instead of silently returning NAs. Suggests increasing `B`, increasing + `kl_fraction`, or switching to `accel = "jackknife"`. (Reported by Tim + Pollington, Thomas Covert) + +- **PR [\#8](https://github.com/bnaras/bcaboot/issues/8)**: Fixed + missing [`return()`](https://rdrr.io/r/base/function.html) in `K = 0` + early-exit path of [`bcajack()`](../reference/bcajack.md), + [`bcajack2()`](../reference/bcajack2.md), and + [`bcapar()`](../reference/bcapar.md), which caused execution to fall + through to the `K > 0` code. In the rewrite, all early exits use + explicit `return(new_bcaboot(...))`. (Reported by Bettina Gruen) + ### New features - `tidy()` method: returns a tibble with one row per (confidence level, @@ -55,9 +88,11 @@ - `bca_nonpar()` always computes the gbca diagnostic when using `accel = "regression"` (with `tryCatch` for robustness). +- All user-facing messages use `cli` for consistent formatting. + ### Dependencies -- Added `tibble`, `generics`, `lifecycle` to Imports. +- Added `cli`, `tibble`, `generics`, `lifecycle` to Imports. - Added `ggplot2` to Suggests (for [`autoplot()`](https://ggplot2.tidyverse.org/reference/autoplot.html)). diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 4d28cae..87c862a 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -3,4 +3,4 @@ pkgdown: 2.2.0 pkgdown_sha: ~ articles: bcaboot: bcaboot.html -last_built: 2026-04-07T21:27Z +last_built: 2026-04-08T01:00Z diff --git a/docs/reference/bcajack.html b/docs/reference/bcajack.html index be6057f..322c1ad 100644 --- a/docs/reference/bcajack.html +++ b/docs/reference/bcajack.html @@ -196,19 +196,20 @@Examplesbcajack(x = Xy, B = 1000, func = rfun, m = 34, verbose = FALSE) #> Warning: `bcajack()` was deprecated in bcaboot 1.0. #> ℹ Please use `bca_nonpar()` instead. -#> BCa Bootstrap Confidence Intervals -#> Method: nonpar (jackknife acceleration) -#> B = 1000, theta = 0.5065603, sdboot = 0.03287545 -#> -#> Confidence limits: +#> +#> ── BCa Bootstrap Confidence Intervals +#> Method: nonpar (jackknife acceleration) +#> B = 1000, theta = 0.5065603, sdboot = 0.03284722 +#> +#> Confidence limits: #> conf.level bca.lo bca.hi std.lo std.hi -#> 0.95 0.4349782 0.5615867 0.4421256 0.5709950 -#> 0.90 0.4425891 0.5527242 0.4524850 0.5606356 -#> 0.80 0.4545379 0.5408992 0.4644287 0.5486919 -#> 0.68 0.4643673 0.5312118 0.4738671 0.5392536 -#> -#> Diagnostics: -#> z0 = -0.2455895, a = -0.001290911, sdjack = 0.01864547 +#> 0.95 0.4238753 0.5582875 0.4421809 0.5709397 +#> 0.90 0.4342607 0.5496734 0.4525314 0.5605892 +#> 0.80 0.4513913 0.5388794 0.4644649 0.5486557 +#> 0.68 0.4617252 0.5305165 0.4738951 0.5392255 +#> +#> Diagnostics: +#> z0 = -0.26112, a = -0.01143494, sdjack = 0.02985439