Skip to content

Commit

Permalink
small change in demos
Browse files Browse the repository at this point in the history
  • Loading branch information
acp29 committed Apr 27, 2024
1 parent b63bad5 commit 552ea1a
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions inst/bootstrp.m
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,11 @@
%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
%!
%! % Compute 50 bootstrap statistics for the mean and calculate the bootstrap
%! % Compute 500 bootstrap statistics for the mean and calculate the bootstrap
%! % standard error of the mean
%! bootstat = bootstrp (50, @mean, data, 'seed', 1);
%! bootstat = bootstrp (500, @mean, data, 'seed', 1);
%! % Or equivalently
%! bootstat = bootstrp (50, @mean, data, 'seed', 1, 'loo', false);
%! bootstat = bootstrp (500, @mean, data, 'seed', 1, 'loo', false);
%! std (bootstat)

%!demo
Expand All @@ -464,9 +464,9 @@
%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
%!
%! % Compute 50 bootknife statistics for the mean and calculate the unbiased
%! % Compute 500 bootknife statistics for the mean and calculate the unbiased
%! % bootstrap standard error of the mean
%! bootstat = bootstrp (50, @mean, data, 'seed', 1, 'loo', true);
%! bootstat = bootstrp (500, @mean, data, 'seed', 1, 'loo', true);
%! std (bootstat)

%!demo
Expand All @@ -477,9 +477,9 @@
%! % Split data into consecutive blocks of two data observations per cell
%! data_blocks = mat2cell (data, 2 * (ones (13, 1)), 1);
%!
%! % Compute 50 bootknife statistics for the mean and calculate the unbiased
%! % Compute 500 bootknife statistics for the mean and calculate the unbiased
%! % bootstrap standard error of the mean
%! bootstat = bootstrp (50, @(x) mean (cell2mat (x)), data_blocks, 'seed', 1, ...
%! bootstat = bootstrp (500, @(x) mean (cell2mat (x)), data_blocks, 'seed', 1, ...
%! 'loo', true);
%! std (bootstat)

Expand All @@ -489,9 +489,9 @@
%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
%! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
%!
%! % Compute 50 bootknife statistics for the variance and calculate the
%! % Compute 500 bootknife statistics for the variance and calculate the
%! % unbiased standard error of the variance
%! bootstat = bootstrp (50, {@var, 1}, data, 'loo', true);
%! bootstat = bootstrp (500, {@var, 1}, data, 'loo', true);
%! std (bootstat)

%!demo
Expand All @@ -502,11 +502,11 @@
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
%! 474 329 555 282 423 323 256 431 437 240]';
%!
%! % Compute 50 bootknife statistics for the mean difference between X and Y
%! % Compute 500 bootknife statistics for the mean difference between X and Y
%! % and calculate the unbiased bootstrap standard error of the mean difference
%! bootstat = bootstrp (50, @(x, y) mean (x - y), X, Y, 'loo', true);
%! bootstat = bootstrp (500, @(x, y) mean (x - y), X, Y, 'loo', true);
%! % Or equivalently
%! bootstat = bootstrp (50, @(x, y) mean (x - y), X, Y, 'loo', true, ...
%! bootstat = bootstrp (500, @(x, y) mean (x - y), X, Y, 'loo', true, ...
%! 'match', true);
%! std (bootstat)

Expand All @@ -518,10 +518,10 @@
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
%! 474 329 555 282 423 323 256 431 437 240]';
%!
%! % Compute 50 bootknife statistics for the difference in mean between
%! % Compute 500 bootknife statistics for the difference in mean between
%! % between independent samples X and Y and calculate the unbiased bootstrap
%! % standard error of the difference in mean
%! bootstat = bootstrp (50, @(x, y) mean (x) - mean(y), X, Y, 'loo', true, ...
%! bootstat = bootstrp (500, @(x, y) mean (x) - mean(y), X, Y, 'loo', true, ...
%! 'match', false);
%! std (bootstat)

Expand All @@ -533,9 +533,9 @@
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
%! 474 329 555 282 423 323 256 431 437 240]';
%!
%! % Compute 50 bootstrap statistics for the correlation coefficient and
%! % Compute 500 bootstrap statistics for the correlation coefficient and
%! % calculate the bootstrap standard error of the correlation coefficient
%! bootstat = bootstrp (50, @cor, X, Y);
%! bootstat = bootstrp (500, @cor, X, Y);
%! std (bootstat)

%!demo
Expand All @@ -546,9 +546,9 @@
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
%! 474 329 555 282 423 323 256 431 437 240]';
%!
%! % Compute 50 bootstrap statistics for the coefficient of determination and
%! % Compute 500 bootstrap statistics for the coefficient of determination and
%! % calculate it's bootstrap standard error
%! bootstat = bootstrp (50, {@cor,'squared'}, X, Y);
%! bootstat = bootstrp (500, {@cor,'squared'}, X, Y);
%! std (bootstat)

%!demo
Expand All @@ -572,9 +572,9 @@
%! Y = [247 461 526 302 636 593 393 409 488 381 ...
%! 474 329 555 282 423 323 256 431 437 240]';
%!
%! % Compute 50 bootstrap statistics for the slope and intercept of a linear
%! % Compute 500 bootstrap statistics for the slope and intercept of a linear
%! % regression and calculate their bootstrap standard errors
%! bootstat = bootstrp (50, @mldivide, cat (2, ones (20, 1), X), Y);
%! bootstat = bootstrp (500, @mldivide, cat (2, ones (20, 1), X), Y);
%! std (bootstat)

%!test
Expand Down

0 comments on commit 552ea1a

Please sign in to comment.