Skip to content

Commit e5a143c

Browse files
author
acp29
committed
Bug fix and performance enhancement
- Fixed bug in 'boot' function (specifically the windows versions of boot.mex and it's source code boot.cpp). This bug prevented uniform resampling across the whole sample when n*nboot becomes too large. This bug was introduced in commit f07cb46 (8 Dec 2022) and was present in releases 5.1.0 - 5.1.4. The fix has reintroduced C++11 dependency for compiling boot.mex. - Fixed incorrect precompiled binaries for Octave mex files, which were 32-bit when they should have been 64-bit windows - Added a series of significant performance enhancements in `bootknife` by vectorizing the code for computing bias, standard errors and confidence intervals for each element of the return value of bootfun. The performance enhancement is achieved by reducing the number of (bootfun) function evaluations.
1 parent afe34b7 commit e5a143c

File tree

34 files changed

+867
-775
lines changed

34 files changed

+867
-775
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: statistics-bootstrap
2-
version: 5.1.4
3-
date: 2023-01-09
2+
version: 5.1.5
3+
date: 2023-01-21
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 bootstrap resampling tools

inst/boot.m

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,31 @@
5252
% Input variables
5353
n = numel(x);
5454
if (n > 1)
55-
sz = size(x);
55+
sz = size (x);
5656
isvec = true;
57-
if all(sz > 1)
58-
error('The first input argument must be either a scalar (N) or vector (X).');
57+
if (all (sz > 1))
58+
error('boot: The first input argument must be either a scalar (N) or vector (X).');
5959
end
6060
else
6161
n = x;
6262
isvec = false;
63-
if ( (n <= 0) || (n ~= fix(n)) || isinf(n) || isnan(n) )
64-
error ('The first input argument must be a finite positive integer.')
63+
if ((n <= 0) || (n ~= fix (n)) || isinf (n) || isnan (n))
64+
error ('boot: The first input argument must be a finite positive integer.')
6565
end
6666
end
67-
if (nboot <= 0) || (nboot ~= fix(nboot)) || isinf(nboot) || isnan(nboot) || (max (size (nboot)) > 1)
68-
error ('The second input argument (NBOOT) must be a finite positive integer')
67+
if ((nboot <= 0) || (nboot ~= fix (nboot)) || isinf (nboot) || isnan (nboot) || (max (size (nboot)) > 1))
68+
error ('boot: The second input argument (NBOOT) must be a finite positive integer')
6969
end
70-
if (nargin > 2) && ~isempty(u)
71-
if ~islogical (u)
72-
error ('The third input argument (UNBIASED) must be a logical scalar value')
70+
if ((nargin > 2) && ~ isempty (u))
71+
if (~ islogical (u))
72+
error ('boot: The third input argument (UNBIASED) must be a logical scalar value')
7373
end
7474
else
7575
u = false;
7676
end
77-
if (nargin > 3) && ~isempty(s)
78-
if (isinf(s) || isnan(s) || (max (size (s)) > 1))
79-
error ('The fourth input argument (SEED) must be a finite scalar value')
77+
if ((nargin > 3) && ~ isempty (s))
78+
if (isinf (s) || isnan (s) || (max (size (s)) > 1))
79+
error ('boot: The fourth input argument (SEED) must be a finite scalar value')
8080
end
8181
rand ('twister', s);
8282
end
@@ -85,14 +85,14 @@
8585
bootsam = zeros (n, nboot);
8686

8787
% Initialize weight vector defining the available row counts remaining
88-
if (nargin > 4) && ~isempty(w)
88+
if ((nargin > 4) && ~ isempty (w))
8989
% Assign user defined weights (counts)
9090
% Error checking
91-
if (numel(w) ~= n)
92-
error('WEIGHTS must be a vector of length N or be the same length as X.');
91+
if (numel (w) ~= n)
92+
error ('boot: WEIGHTS must be a vector of length N or be the same length as X.');
9393
end
94-
if (sum(w) ~= n * nboot)
95-
error('The elements of WEIGHTS must sum to N * NBOOT.')
94+
if (sum (w) ~= n * nboot)
95+
error ('boot: The elements of WEIGHTS must sum to N * NBOOT.')
9696
end
9797
c = w;
9898
else
@@ -117,7 +117,7 @@
117117
if (u)
118118
d(r) = 0;
119119
end
120-
if ~sum (d)
120+
if (~ sum (d))
121121
d = c;
122122
end
123123
d = cumsum (d);

inst/boot.mexmaci64

-34.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)