Skip to content

Commit 35a98f8

Browse files
committed
added more demos to bootstrp and updated MATLAB toolbox
1 parent cd6d2d1 commit 35a98f8

File tree

4 files changed

+113
-5
lines changed

4 files changed

+113
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: statistics-resampling
22
version: 5.5.9
3-
date: 2024-04-21
3+
date: 2024-04-24
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/bootstrp.m

Lines changed: 111 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
w = value;
152152
case {'options', 'option'}
153153
paropt = value;
154-
case 'match'
154+
case {'match', 'matched', 'matching'}
155155
match = value;
156156
case 'seed'
157157
seed = value;
@@ -444,8 +444,116 @@
444444
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
445445
%!
446446
%! % Compute 50 bootstrap statistics for the mean and calculate the bootstrap
447-
%! % standard error
448-
%! bootstat = bootstrp (50, @mean, data)
447+
%! % standard error of the mean
448+
%! bootstat = bootstrp (50, @mean, data, 'seed', 1);
449+
%! % Or equivalently
450+
%! bootstat = bootstrp (50, @mean, data, 'seed', 1, 'loo', false);
451+
%! std (bootstat)
452+
453+
%!demo
454+
%!
455+
%! % Input univariate dataset
456+
%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
457+
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
458+
%!
459+
%! % Compute 50 bootknife statistics for the mean and calculate the unbiased
460+
%! % bootstrap standard error of the mean
461+
%! bootstat = bootstrp (50, @mean, data, 'seed', 1, 'loo', true);
462+
%! std (bootstat)
463+
464+
%!demo
465+
%!
466+
%! % Input univariate dataset
467+
%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
468+
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
469+
%! % Split data into consecutive blocks of two data observations per cell
470+
%! data_blocks = mat2cell (data, 2 * (ones (13, 1)), 1);
471+
%!
472+
%! % Compute 50 bootknife statistics for the mean and calculate the unbiased
473+
%! % bootstrap standard error of the mean
474+
%! bootstat = bootstrp (50, @(x) mean (cell2mat (x)), data_blocks, 'seed', 1, ...
475+
%! 'loo', true);
476+
%! std (bootstat)
477+
478+
%!demo
479+
%!
480+
%! % Input univariate dataset
481+
%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
482+
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
483+
%!
484+
%! % Compute 50 bootknife statistics for the variance and calculate the
485+
%! % unbiased standard error of the variance
486+
%! bootstat = bootstrp (50, {@var, 1}, data, 'loo', true);
487+
%! std (bootstat)
488+
489+
%!demo
490+
%!
491+
%! % Input two-sample dataset
492+
%! X = [212 435 339 251 404 510 377 335 410 335 ...
493+
%! 415 356 339 188 256 296 249 303 266 300]';
494+
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
495+
%! 474 329 555 282 423 323 256 431 437 240]';
496+
%!
497+
%! % Compute 50 bootknife statistics for the mean difference between X and Y
498+
%! % and calculate the unbiased bootstrap standard error of the mean difference
499+
%! bootstat = bootstrp (50, @(x, y) mean (x - y), X, Y, 'loo', true);
500+
%! % Or equivalently
501+
%! bootstat = bootstrp (50, @(x, y) mean (x - y), X, Y, 'loo', true, ...
502+
%! 'match', true);
503+
%! std (bootstat)
504+
505+
%!demo
506+
%!
507+
%! % Input two-sample dataset
508+
%! X = [212 435 339 251 404 510 377 335 410 335 ...
509+
%! 415 356 339 188 256 296 249 303 266 300]';
510+
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
511+
%! 474 329 555 282 423 323 256 431 437 240]';
512+
%!
513+
%! % Compute 50 bootknife statistics for the difference in mean between
514+
%! % between independent samples X and Y and calculate the unbiased bootstrap
515+
%! % standard error of the difference in mean
516+
%! bootstat = bootstrp (50, @(x, y) mean (x) - mean(y), X, Y, 'loo', true, ...
517+
%! 'match', false);
518+
%! std (bootstat)
519+
520+
%!demo
521+
%!
522+
%! % Input bivariate dataset
523+
%! X = [212 435 339 251 404 510 377 335 410 335 ...
524+
%! 415 356 339 188 256 296 249 303 266 300]';
525+
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
526+
%! 474 329 555 282 423 323 256 431 437 240]';
527+
%!
528+
%! % Compute 50 bootstrap statistics for the correlation coefficient and
529+
%! % calculate the bootstrap standard error of the correlation coefficient
530+
%! bootstat = bootstrp (50, @cor, X, Y);
531+
%! std (bootstat)
532+
533+
%!demo
534+
%!
535+
%! % Input bivariate dataset
536+
%! X = [212 435 339 251 404 510 377 335 410 335 ...
537+
%! 415 356 339 188 256 296 249 303 266 300]';
538+
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
539+
%! 474 329 555 282 423 323 256 431 437 240]';
540+
%!
541+
%! % Compute 50 bootstrap statistics for the coefficient of determination and
542+
%! % calculate the bootstrap standard error of the coefficient of determination
543+
%! bootstat = bootstrp (50, {@cor,'squared'}, X, Y);
544+
%! std (bootstat)
545+
546+
%!demo
547+
%!
548+
%! % Input bivariate dataset
549+
%! X = [212 435 339 251 404 510 377 335 410 335 ...
550+
%! 415 356 339 188 256 296 249 303 266 300]';
551+
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
552+
%! 474 329 555 282 423 323 256 431 437 240]';
553+
%!
554+
%! % Compute 50 bootstrap statistics for the slope and intercept of a linear
555+
%! % regression and calculate there bootstrap standard errors
556+
%! bootstat = bootstrp (50, @mldivide, cat (2, ones (20, 1), X), Y);
449557
%! std (bootstat)
450558

451559
%!test

matlab/statistics-resampling.mltbx

1.9 KB
Binary file not shown.

matlab/statistics-resampling.prj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<deployment-project plugin="plugin.toolbox" plugin-version="1.0">
2-
<configuration build-checksum="1816228546" file="Y:\Documents\GitHub\statistics-resampling\matlab\statistics-resampling.prj" location="Y:\Documents\GitHub\statistics-resampling\matlab" name="statistics-resampling" target="target.toolbox" target-name="Package Toolbox">
2+
<configuration build-checksum="2178968502" file="Y:\Documents\GitHub\statistics-resampling\matlab\statistics-resampling.prj" location="Y:\Documents\GitHub\statistics-resampling\matlab" name="statistics-resampling" target="target.toolbox" target-name="Package Toolbox">
33
<param.appname>statistics-resampling</param.appname>
44
<param.authnamewatermark>Andrew Penn</param.authnamewatermark>
55
<param.email>andy.c.penn@gmail.com</param.email>

0 commit comments

Comments
 (0)