Skip to content

Commit 510c1a7

Browse files
committed
made calculation method of influence values consistent with the empinf function in the R 'boot' package
1 parent d9cd6ce commit 510c1a7

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: statistics-resampling
2-
version: 5.5.10
3-
date: 2024-04-27
2+
version: 5.5.11
3+
date: 2024-05-13
44
author: Andrew Penn <andy.c.penn@gmail.com>
55
maintainer: Andrew Penn <andy.c.penn@gmail.com>
66
title: A statistics package with a variety of resampling tools

inst/bootci.m

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,10 @@
422422
otherwise
423423

424424
% Other interval types are natively supported in bootknife function
425-
% Undocumented input argument for simple bootstrap resampling
425+
% Use undocumented input argument 'loo' = false for simple bootstrap
426+
% resampling (instead of bootknife resampling)
426427
[stats, bootstat, bootsam] = bootknife (data, nboot, bootfun, alpha, ...
427-
strata, ncpus, [], [], ISOCTAVE, true, loo);
428+
strata, ncpus, [], [], ISOCTAVE, true, loo);
428429

429430
end
430431

@@ -763,9 +764,9 @@
763764
%! % normal | 81.5% | 3.0% | 15.5% | 0.77 | 1.21 |
764765
%! % percentile | 81.5% | 0.9% | 17.6% | 0.76 | 0.91 |
765766
%! % basic | 81.1% | 2.5% | 16.4% | 0.78 | 1.09 |
766-
%! % BCa | 84.2% | 5.4% | 10.4% | 0.86 | 1.82 |
767+
%! % BCa | 83.9% | 5.2% | 10.9% | 0.83 | 1.84 |
767768
%! % bootstrap-t | 89.2% | 4.3% | 6.5% | 0.99 | 2.15 |
768-
%! % calibrated | 87.4% | 4.2% | 8.4% | 0.91 | 2.03 |
769+
%! % calibrated | 88.9% | 3.7% | 7.4% | 0.89 | 2.04 |
769770
%! % ---------------------|----------|--------|--------|--------|-------|
770771
%! % parametric - exact | 90.8% | 3.7% | 5.5% | 0.99 | 2.52 |
771772

@@ -852,8 +853,8 @@
852853
%! ci = bootci(1999,{{@var,1},A},'alpha',0.1,'type','bca','seed',1);
853854
%! if (isempty (regexp (which ('boot'), 'mex$')))
854855
%! % test boot m-file result
855-
%! assert (ci(1), 115.3439904214919, 1e-07);
856-
%! assert (ci(2), 254.8041855869813, 1e-07);
856+
%! assert (ci(1), 115.9276292059273, 1e-07);
857+
%! assert (ci(2), 255.789475809047, 1e-07);
857858
%! end
858859
%!
859860
%! % Nonparametric 90% bootstrap-t confidence intervals (double bootstrap)
@@ -883,7 +884,7 @@
883884
%! % Probability 57 (Springer)
884885
%! LSAT = [576 635 558 578 666 580 555 661 651 605 653 575 545 572 594].';
885886
%! GPA = [3.39 3.3 2.81 3.03 3.44 3.07 3 3.43 ...
886-
%! 3.36 3.13 3.12 2.74 2.76 2.88 2.96].';
887+
%! 3.36 3.13 3.12 2.74 2.76 2.88 2.96].';
887888
%!
888889
%! % Nonparametric 90% percentile confidence intervals (single bootstrap)
889890
%! % Percentile intervals on page 266 are 0.524 - 0.928
@@ -899,8 +900,8 @@
899900
%! ci = bootci(1999,{@cor,LSAT,GPA},'alpha',0.1,'type','bca','seed',1);
900901
%! if (isempty (regexp (which ('boot'), 'mex$')))
901902
%! % test boot m-file result
902-
%! assert (ci(1), 0.4107777334127511, 1e-07);
903-
%! assert (ci(2), 0.9234715078308394, 1e-07);
903+
%! assert (ci(1), 0.4132871532174259, 1e-07);
904+
%! assert (ci(2), 0.9237685885933666, 1e-07);
904905
%! end
905906
%!
906907
%! % Nonparametric 90% calibrated percentile confidence intervals

inst/bootclust.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@
552552
end
553553
end
554554
% Calculate empirical influence function
555-
U = (nx - 1) * bsxfun (@minus, mean (T, 2), T);
555+
U = (nx - 1) * bsxfun (@minus, T0, T);
556556
a = sum (U.^3, 2) ./ (6 * sum (U.^2, 2) .^ 1.5);
557557
catch
558558
% Revert to bias-corrected (BC) bootstrap confidence intervals
@@ -1058,8 +1058,8 @@ function print_output (stats, nboot, nalpha, alpha, probs, m, bootfun_str, ...
10581058
%! assert (stats.original, 171.534023668639, 1e-08);
10591059
%! assert (stats.bias, -6.916841556872669, 1e-08);
10601060
%! assert (stats.std_error, 42.5668171689963, 1e-08);
1061-
%! assert (stats.CI_lower, 117.0129329921189, 1e-08);
1062-
%! assert (stats.CI_upper, 269.5860065995567, 1e-08);
1061+
%! assert (stats.CI_lower, 117.211853429442, 1e-08);
1062+
%! assert (stats.CI_upper, 270.1620774419748, 1e-08);
10631063
%! end
10641064
%!
10651065
%! % Exact intervals based on normal theory are 118.4 - 305.2 (Table 14.2)
@@ -1097,6 +1097,6 @@ function print_output (stats, nboot, nalpha, alpha, probs, m, bootfun_str, ...
10971097
%! assert (stats.original, 0.7763744912894071, 1e-08);
10981098
%! assert (stats.bias, -0.007472442917410338, 1e-08);
10991099
%! assert (stats.std_error, 0.1355235987517371, 1e-08);
1100-
%! assert (stats.CI_lower, 0.4179653612679617, 1e-08);
1101-
%! assert (stats.CI_upper, 0.9240227537437981, 1e-08);
1100+
%! assert (stats.CI_lower, 0.4193007209659811, 1e-08);
1101+
%! assert (stats.CI_upper, 0.9242671615802232, 1e-08);
11021102
%! end

inst/bootknife.m

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,9 @@
752752
% Calculate empirical influence function
753753
if (~ isempty (strata))
754754
gk = sum (g .* repmat (nk, n, 1), 2).';
755-
U = bsxfun (@times, gk - 1, bsxfun (@minus, mean (T, 2), T));
755+
U = bsxfun (@times, gk - 1, bsxfun (@minus, T0, T));
756756
else
757-
U = (n - 1) * bsxfun (@minus, mean (T, 2), T);
757+
U = (n - 1) * bsxfun (@minus, T0, T);
758758
end
759759
a = sum (U.^3, 2) ./ (6 * sum (U.^2, 2) .^ 1.5);
760760
catch
@@ -1443,7 +1443,7 @@ function print_output (stats, nboot, alpha, l, m, bootfun_str, strata)
14431443
%! % method | 0.05 | 0.95 | length | shape |
14441444
%! % --------------------------------------|--------|--------|--------|-------|
14451445
%! % ci2 - percentile (equal-tailed) | 96.2 | 237.2 | 141.0 | 0.87 |
1446-
%! % ci4 - BCa | 115.3 | 263.8 | 148.5 | 1.64 |
1446+
%! % ci4 - BCa | 116.1 | 265.1 | 149.0 | 1.69 |
14471447
%! % ci6a - calibrated (equal-tailed) | 83.0 | 252.9 | 169.9 | 0.92 |
14481448
%! % ci6b - calibrated | 113.2 | 282.4 | 169.2 | 1.90 |
14491449
%! % --------------------------------------|--------|--------|--------|-------|
@@ -1458,13 +1458,14 @@ function print_output (stats, nboot, alpha, l, m, bootfun_str, strata)
14581458
%! % method | coverage | lower | upper | length | shape |
14591459
%! % ---------------------------|----------|--------|--------|--------|-------|
14601460
%! % percentile (equal-tailed) | 81.9% | 1.3% | 16.8% | 0.78 | 0.91 |
1461-
%! % BCa | 85.6% | 5.2% | 9.2% | 0.87 | 1.84 |
1461+
%! % BCa | 85.0% | 4.6% | 10.4% | 0.85 | 1.82 |
14621462
%! % calibrated (equal-tailed) | 90.0% | 0.1% | 9.9% | 1.01 | 1.04 |
14631463
%! % calibrated | 90.3% | 4.5% | 5.2% | 0.99 | 2.21 |
14641464
%! % ---------------------------|----------|--------|--------|--------|-------|
14651465
%! % parametric - exact | 90.8% | 3.7% | 5.5% | 0.99 | 2.52 |
14661466
%!
1467-
%! % Summary of bias statistics from 'boot' package in R
1467+
%! % Summary of bias statistics computed using the 'statistics-resampling'
1468+
%! % package for Octave/Matlab
14681469
%! %
14691470
%! % method | original | bias | bias-corrected |
14701471
%! % -----------------------------------|----------|---------|----------------|
@@ -1607,8 +1608,8 @@ function print_output (stats, nboot, alpha, l, m, bootfun_str, strata)
16071608
%! assert (stats.original, 171.534023668639, 1e-08);
16081609
%! assert (stats.bias, -6.916841556872669, 1e-08);
16091610
%! assert (stats.std_error, 42.5668171689963, 1e-08);
1610-
%! assert (stats.CI_lower, 117.0129329921189, 1e-08);
1611-
%! assert (stats.CI_upper, 269.5860065995567, 1e-08);
1611+
%! assert (stats.CI_lower, 117.211853429442, 1e-08);
1612+
%! assert (stats.CI_upper, 270.1620774419748, 1e-08);
16121613
%! end
16131614
%!
16141615
%! % Nonparametric 90% calibrated equal-tailed percentile confidence intervals
@@ -1670,8 +1671,8 @@ function print_output (stats, nboot, alpha, l, m, bootfun_str, strata)
16701671
%! assert (stats.original, 0.7763744912894071, 1e-08);
16711672
%! assert (stats.bias, -0.008589727569214833, 1e-08);
16721673
%! assert (stats.std_error, 0.1440139406035633, 1e-08);
1673-
%! assert (stats.CI_lower, 0.3954734403669555, 1e-08);
1674-
%! assert (stats.CI_upper, 0.9323937461477884, 1e-08);
1674+
%! assert (stats.CI_lower, 0.3970241602178715, 1e-08);
1675+
%! assert (stats.CI_upper, 0.9326378952057675, 1e-08);
16751676
%! end
16761677
%!
16771678
%! % Nonparametric 90% calibrated equal-tailed percentile confidence intervals

0 commit comments

Comments
 (0)